Google Maps Static Map - Custom icons limit
I am generating a static map from Google maps with up to 26 custom icons (in this example, 15), but for some reason it only loads the first 5 icons. Here is the URL:
http://bit.ly/fGdtft
Does Google maps have a limit on the number of icons that can be loaded? There's nothing explicit in the documentation - all of the other imag开发者_Go百科es exist, in fact if I switch icon A with icon H, icon H will appear where icon A is supposed to be and where icon H is supposed to be: http://bit.ly/elk8kB
Has anyone else had success this this?
From the static api documentation :
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.
Sorry :(
Here's how I got around this:
You probably already know how, and depending on your source it's going to be different anyway, but collect up all your map data. Required bits are going to be: center point, zoom, map type, and output image size. I am going to assume sensor (if the application has access to GPS) is false. Also you are going to need all of your marker information which will include the icon you are going to use, and the geo coordinates of them.
I POSTed this all to the CF page that is going to make all the magic happen.
Map your first 5 points as normal. Get the results as a .png
Map your next 5 points but add "style=feature:all|visibility:off" to the query string, get result as a .png. This will give you a png with a transparent background but will have all of your marker icons on it. It will be the same size as your initial map, and the markers will be placed correctly withing that rectangle.
Watermark that image on top of your initial map. NOTE: this step is probably going to vary the most depending on your language of choice and what image manipulation features it offers.
Repeat 4 and 5 until you have all of your markers.
Write out you image with all of the markers now on it.
Serve up a link to that file instead of using the normal google link.
I have a more detailed explanation here with some code example in ColdFusion.
精彩评论