- Home
- Forum
- Angular - EJ 2
- Viewport coordinates in Maps component
Viewport coordinates in Maps component
Thank you for contacting Syncfusion support.
We can use the provided code to find the viewport co-ordinates in the Maps control. But the arrangement of the values in your code is not in correct format. If we need to get the viewport co-ordinates in the left of the control, we must use the first point as (0, 0) as we are rendering the map from the left side and the extreme right side of the viewport co-ordinate will be the height and width of the Maps. Please find the modified code snippet below.
|
public getMapBounds() {
return [this.maps.pointToLatLong(0, 0), this.maps.pointToLatLong(this.maps.availableSize.height, this.maps.availableSize.width)];
} |
Please let us know if you need any further assistance.
Regards,
Swetha Babu
|
public GetMapBounds() {
let pointone: GeoPosition = this.maps.pointToLatLong(0, 0); let pointtwo: GeoPosition = this.maps.pointToLatLong(this.maps.availableSize.height, this.maps.availableSize.width); let mapBounds: object = { minLat: Math.min(pointone.latitude, pointtwo.latitude), minLong: Math.min(pointone.longitude, pointtwo.longitude), maxLat: Math.max(pointtwo.latitude, pointone.latitude), maxLong: Math.max(pointtwo.longitude, pointone.longitude) }; return mapBounds; } |
Please let us know if the sample above meets your requirements. If we have misunderstood your question, please provide more information and we will assist you further.
Hello,
Thanks a lot, with your help, I managed to make it works.
I'm facing a last issue:
my markers is displayed as picture with the help of the properties shape='Image' and imageUrlValuePath: 'pict' (pict is a property of my marker object). Alas the marker is not rendered at all (nothing in the map, not even a broken picture).
I've managed to track down the problem to this line of code in the markerShapeChoose function in ej2-maps.es2015.js:
const shapeImage = (!isNullOrUndefined(eventArgs.imageUrlValuePath) && !isNullOrUndefined(data[eventArgs.imageUrlValuePath])) ?
getValueFromObject(data, eventArgs.imageUrlValuePath).toString() : eventArgs.imageUrl;
eventArgs.imageUrl = shapeImage;
Changing this line to:
const shapeImage = (!isNullOrUndefined(eventArgs.imageUrlValuePath) && !isNullOrUndefined(data[eventArgs.imageUrlValuePath])) ?
((eventArgs.imageUrlValuePath.indexOf('.') > -1) ? getValueFromObject(data, eventArgs.imageUrlValuePath).toString() : data[eventArgs.imageUrlValuePath]) : eventArgs.imageUrl;
eventArgs.imageUrl = shapeImage;
And voila! my markers are displayed. Should I fill a bug report for this?
Regards,
Indumathi R
Indumathi R.
- 9 Replies
- 3 Participants
- Marked answer
-
MA Matthieu
- Mar 29, 2021 12:58 PM UTC
- Dec 20, 2021 04:57 PM UTC