Custom Marker Icon not showing Google Static Maps v2 - google-maps

I am using the Static Google Maps API v2 to download a static image of a map view with a singular marker just showing one image. However, the image added to the marker parameter of the url doesn't seem to be making any difference, and just a red marker is shown at the location.
Please can you tell me where I am going wrong?
http://maps.googleapis.com/maps/api/staticmap
?center=37.446754,-77.572746
&size=70x61
&maptype=roadmap
&sensor=true
&scale=2
&zoom=15
&key=some_key
&markers=icon:https://foursquare.com/img/categories_v2/shops/financial_bg_64.png|37.446754,-77.572746

your image URL must remove the letter S HTTPS secure site, so work, for example like this:
http://foursquare.com/img/categories_v2/shops/financial_bg_64.png
complete code:
http://maps.googleapis.com/maps/api/staticmap?
center=37.446754,-77.572746&size=70x61&maptype=roadmap&sensor=false
&scale=2&zoom=15
&markers=icon:http://foursquare.com/img/categories_v2/shops/financial_bg_64.png|37.446754,-77.572746

In my experience,
There is no such requirement of http or https just care for icon size .
icon size should not exceed more than 64X64 pixels in size , Static map will happily show the custom icon . accept if found correct #max_
http://maps.googleapis.com/maps/api/staticmap?
center=37.446754,-77.572746&size=70x61&maptype=roadmap&sensor=false
&scale=2&zoom=15
&markers=icon:http://foursquare.com/img/categories_v2/shops/financial_64X64.png|37.446754,-77.572746
off course use your image with below 64X64 dimension instead of
http://foursquare.com/img/categories_v2/shops/financial_64X64.png

You're actually not doing anything wrong, it's Google to blame:
"The Google Static Maps API does not support custom icon URLs that use HTTPS"

Related

google static map with Overlay image

How can I pass overlay map image with image bounds in static map service?
I have an image which I want to overlay on map at certain position, looks like current static map image service doesn't provide any parameter to pass that.
You are right. On static maps you can't send add custom overlays like in the javascript api. But maybe you can consider this as work around, you Add custom markers on your map URL.
You can use up to five unique custom icons per request. This limitation does not mean that you are limited to only 5 marked locations on your map. Each unique icon may be used with more than one markers location on your map.
Icon format:
Icon images may be in PNG, JPEG or GIF formats, though PNG is recommended.
Icons may be up to 4096 pixels maximum size (64x64 for square images).

Google maps - move embed to static

So, i have custom route on my map. I put in on my web (local page to be precise). Unfortuently, on high dpi screen texts are very tiny. I've found static maps to be able to rescale map (https://developers.google.com/maps/documentation/static-maps/intro) but have no idea how to show my custom route on static map (route was generated from GPX file).
Is there any way to do it?
Regards!
So, after few hours of research i've found that i need to convert gps coords into polyline, ie. https://www.daftlogic.com/projects-online-csv-polyline-encoder.htm
It generates example link for google maps.

Encoding URL by Google static maps

I created the URL for static maps, everything works, but now convert this link you can open the map in Google?That is on my website there is a picture card, but in the form of links, similar to here. How now add a link to this image, so when you click on the image to the full Google maps?
Advance, thanks!
Maybe this (if I understood you) - depending on what is in .$full_address.:
<img src="http://maps.googleapis.com/maps/api/staticmap?center=".$full_address."&zoom=15&size=400x400".$markers."&sensor=false' />">
This will turn your static map image into a link to Google Maps.

Max url length with Google Maps static image

I need to create a static image of google map with several markers, and each marker has a custom icon.
In the Api DOC there is the note: Static Map URLs are restricted to 2048 characters in size. In practice, you will probably not have need for URLs longer than this, unless you produce complicated maps with a high number of markers and paths.
The url is very long.... There is the position for each marker and the URL for the custom icon for each one.
I've already tried with POST request ma it is not supported.
There is another way to create a static map image without max length limitation?
A possible way might be this, but i don't know if is it possible: I've create my custom map using the function in GMaps, and i have added all the markers i need.
There is a way to access in static way to this particular map? so in the url i have to give only the center of the map and other parameters (zoom, ...), but all the markers are already positioned.
Or... another idea... Can i submit the URL of a KML with all markers positioned instead each single marker position+icon url?
FYI, Google recently updated the limit to 8192.
Have you tried using a URL shortener for the icon urls? I believe the static map API will respect services that make URLs shorter... might save you a few characters.
You might wanna check out toopola´s API to help working with Google Static Maps, I am about to make my own attempt.
Another idea
find map area that contains all the markers
divide the map area into rectangular pieces (4 pieces for example)
create image url for each part, but include in url only markers and icons visible on map
show images
Мethod of division depends on the markers position.
Yes, you can definitely do this with the Javascript API.
I have built a few applications using that API. It can be a little tricky to get your head around, but it is pretty good. For what you want to do, it would not be too difficult. If the user has to be able to interact with the map and add pins and such, it starts to get a little more complicated because you have to capture clicks and such.
Does the map its self need to be available as a URL, or does it just need to be embedded on some page and that URL can be used?
The Javascript API will work best if you can embed the map into an existing webpage.

google maps: use directly on google server?

Usually u have to set up a little script + htmlpage on your server to run google maps,
but i was wondering - is it possible to use google maps directly?
i mean by just calling an url with parameters (gpoint coordinates, zoomfactor ..) and it loads the map fullscreen without having to use my own server?
Sounds like you might be after the static maps api. You can build a URL specifying the properties of the map like:
zoom
position
markers (including custom markers)
image size
etc
and you will get back a rendered image of the map. Something like:
Obviously this just gives you a fixed image of the map you are after. If you need a dynamic Google map, then you will need to use the Google Maps Javascript API.
Not hosted by Google. You might find some other website that uses the API to do the same thing.
Google Maps API