Markers are not shown in static google map - google-maps

I am having google static map url this way with multiple markers.
https://maps.googleapis.com/maps/api/staticmap?size=1100x795&markers=color:red|label:S|45.459041,-98.430198&markers=color:red|label:S|45.469042,-98.430199&markers=color:red%7Clabel:S%7C40.702147,-74.015794&markers=color:red%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Clabel:C%7C40.718217,-73.998284
But in the map only 2 markers are shown.
I have even tried adding these parameters in the url but still it showing only 2 markers in my map.
&maptype=roadmap
&sensor=fasle
What is the mistake here? can some one help me?
Thanks

It is because of the distance of the markers. The first two markers are near each other and the other three is also near each other, but the first two markers are relatively far from the latter three. I tried getting the Static maps separately and making separate requests for the first two and the latter three and it displays the markers accordingly. I guess because of the distance the markers overlapped.
fiddle of Google Maps Javascript API v3 map showing the same markers (navigate to the markers to see what is happening)
Request for the first two:
https://maps.googleapis.com/maps/api/staticmap?size=1100x795&markers=color:red|label:S|45.459041,-98.430198&markers=color:red|label:S|45.469042,-98.430199
Request for the latter three:
https://maps.googleapis.com/maps/api/staticmap?size=1100x795&markers=color:red%7Clabel:S%7C40.702147,-74.015794&markers=color:red%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Clabel:C%7C40.718217,-73.998284

Related

How to split markers on Google Static Map on same address?

In My application I have to show split of markers which means all markers should be visible. If one marker geo distance is longer than others it should show like below.
In Google Dynamic Map API which is possible by “Spiderfier”. Refer the link below and below image.
http://jawj.github.io/OverlappingMarkerSpiderfier/demo.html
Like this option, I have to split of all markers in Google Static MAP API.
Any possibilities there to visible all markers ?
Static Map URL:
http://maps.googleapis.com/maps/api/staticmap?sensor=false&channel=Resivalue&scale=2&center=29.900598698735365,-95.69396430030821&zoom=13&size=1300x500&maptype=roadmap&markers=color:green%7Clabel:S%7C29.89357,-95.68815999999998&markers=color:pink%7Clabel:1%7C29.893167,-95.68737599999997&markers=color:pink%7Clabel:2%7C29.893904,-95.688424&markers=color:pink%7Clabel:3%7C29.892301,-95.68776500000001&markers=color:pink%7Clabel:4%7C29.892343,-95.68866200000002&markers=color:pink%7Clabel:5%7C29.894404,-95.689029&markers=color:pink%7Clabel:6%7C29.893235272621563,-95.68611836505124&markers=color:pink%7Clabel:7%7C29.892402,-95.68687699999998&markers=color:pink%7Clabel:8%7C29.891934,-95.688918&markers=color:pink%7Clabel:9%7C29.919640547998576,-95.72656616430663
As stated here
Google Static MAP API Disadvantages :
The main disadvantage is the lack of a map interactivity – if we
need a map to scale, move or if we need to roll down a window after
clicking on a marker; Google Static Maps is not a solution for us.
URL address of a map has a restricted length (2048 symbols) which
sometimes may make impossible to present all needed content on a
map.
Limits also apply in the case of own images markers placing on a map
– in this case it is 4096pixels (64 x 64 px).

multiple polygons and multiple markers in Google MAPS API

I am using google maps API for searching houses in a city(any location). In maps, by default markers will be loaded based on database results and user need to select locations they are interested. If user draws multiple polygons around markers, those markers should be visible and other markers should become invisible. I almost done most part of it.
Now the issue is,when i draw multiple polygons, only one marker with one polygon is visible. Other selected markers are getting invisible. I am trying from past two days and able to get it done. Can anyone guide me to fix this issue.
Mentioned issue is kept in jsfiddle, have a look and let me know
Add at the end of your drawFreeHand method: polygons.push(poly);
And change your isPointInside method as below.
function isPointInside(position){
for(var i=0;i<polygons.length;i++)
{
if(google.maps.geometry.poly.containsLocation(position, polygons[i]))
return true;
}
return false;
}
You were comparing with the same poly, that was the problem.

Combining Polylines on Google Static Map

I'm trying to make a static map request with multiple polylines. It works fine when I have a single polyline, but when I add them together I don't get the intended results. Specifically, I'm trying to highlight adjacent street blocks.
Polyline 1 works fine:
https://maps.googleapis.com/maps/api/staticmap?sensor=false&size=400x400&path=weight:10%7Cenc:{d`pEnpypUc#_#u#Q
Polyline 2 works fine:
https://maps.googleapis.com/maps/api/staticmap?sensor=false&size=400x400&path=weight:10%7Cenc:c``pEtjypUi#fAu#zA[j#mAzB
But combined, I get this:
https://maps.googleapis.com/maps/api/staticmap?sensor=false&size=400x400&path=weight:10%7Cenc:{d`pEnpypUc#_#u#Q%7Cc``pEtjypUi#fAu#zA[j#mAzB
This works for me (separate the polyline specifications):
https://maps.googleapis.com/maps/api/staticmap?sensor=false&size=400x400&path=weight:10%7Cenc:c``pEtjypUi#fAu#zA[j#mAzB&path=weight:10%7Cenc:{d`pEnpypUc#_#u#Q
(You need to add "&path=weight:10%7Cenc:YourEncodedPolylineHere" for each polyline)

Google map API v3 markers overlapping

I am making an application with google maps.
When markers are overlapping only the last one is displayed even if the icons are different..
I do not want it to cluster in that case, rather it should show both maybe by changing the coordinates just a but??
Any solutions??
I think this is a pretty elegant solution, called Spiderfying the markers.
https://github.com/jawj/OverlappingMarkerSpiderfier
I'm thinking of using it.
What I do now is use JavaScript to make a fancy popup that hides and shows divs on one marker location (created problematically in PHP, but you could do it on JS too). It has the side benefit of allowing less markers on the map.
Click a black numbered marker on this map to see it in action.
http://www.yourmapper.com/map/111/crime-reports/crime-in-metro-louisville-ky-since-jan-2003.htm
Another option is to use Google Maps API 3 Utility Library, it has a Marker Clusterer.

Is there a maximum number of different marker styles in google static maps api?

I am trying to create aseries of maps with markers. I have experienced, that when there is 5 or more markers shown at the same time, one of the markers are not rendered properly.
Here is an example.
As far as I can see, the icon url is correct, and if i remove one of the markers, it is shown properly..
What is wrong?
From the Static Maps API developer reference:
"The Static Maps service allows up to
five unique custom icons per request.
Note that each of these unique icons
may be used multiple times within the
static map."
http://code.google.com/apis/maps/documentation/staticmaps/