简体   繁体   中英

How do i display all markers on google map even if latitude and longitude having same values?

I have a data which is having same latitude and longitude in array of objects, but when I tried to add markers by using latitude and longitude, only some markers are showing which are not having same values. I am not getting any idea how to display all markers even if latitude and longitude have same values.

For reference I am adding stack blitz URL:- https://stackblitz.com/edit/angular-draw-polygon-google-maps-gwxjlo?file=app%2Fapp.component.ts .

Please help me on this issue.

Thanks in advance

I checked your sample code and I can see that the markers with the same coordinates are being generated. You can only see one marker on that coordinate because the markers are stacked to the same coordinate as they have the same scale and anchor point. If you would like to show them all at once you can change the icon properties especially the scale(1 icon is bigger than the other) or the anchor point(the x and y origin of the marker). Here is a sample code where I added an anchor in your icons and deviate it to different y point.

You can also use different image icons so that the shapes of each icons differ and you will notice that there are multiple icons on that point.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM