Google maps - move embed to static - google-maps

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.

Related

Alternatives to Google Static Maps when the URL gets too big

My end goal is view and print a document (eg, PDF) with business-specific info on it along with a map. The map must have
The aerial imagery background
The features from a KML file.
Google Static Maps works perfectly for this until the KML gets too complex to fit in the URL. I've already shrunk the URL by reducing long/lat precision and encoding the polylines.
Ideas:
I could get the aerial imagery from Google Static Maps, then programmatically draw my KML features onto it, but I'm not sure if that's allowed in the Google Maps Terms of Use.
Are there other ways to coerce static maps to give me what I want?
Does Google have a different mapping service that could ultimately convert a KML into an image with the aerial image background?
Any non-Google services that might help?

How to retrieve a static map showing city or municipality boundaries

I'm not sure where to start looking in the documentation, but I'm trying to load map images of cities with their boundaries outlined.
Like this...
Any help getting started would be greatly appreciated, I'm pretty new to the maps api.
Thanks
There is currently no way to request a map with boundaries automatically rendered on it. Your best bet is to pull the polygon information from another system and render using an encoded polyline if you're using the Static Map API or regular overlays in the JavaScript API.
Google Static Map API
Here it is
here, some links to help you:
Geographical boundaries of states/provinces -> Google Maps Polygon
EInsert extension
Boundary Draw - Google Map Application
Getting neighbourhood boundaries from Google Maps API
https://stackoverflow.com/questions/8441467/can-you-draw-custom-search-boundaries-in-google-map
Ability to draw boundaries on 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

google maps: find out coordinates

i'm parsing some html data which has google maps embedded (displaying just one certain point) and i was wondering:
how can i find out the exact geographic coordinates of that point?
thx
I will look into this further but if you are able to see the Google Maps representation, you can type this into your browser and it will pinpoint the exact center location:
javascript:void(prompt('',gApplication.getMap().getCenter()));
Very useful if you want to get quick lat/long values. Is this the kind of info you need?
Parsing HTML files and want to find what point map is displaying?
This is likely not be possible (correct me if I am wrong). The map is a JavaScript object that only exists inside a browser - it is only text code in the html file. Map variables and data only exist inside the JavaScript engine running inside the browser, their dynamic variable state cannot be stored in a file ahead of time.
If the site is displaying a static map image then we have a different story. Just parse the URL to google static maps requesting the map image.
i found out that the actual coordinates were stored in the html :)
Have you tried the LatLng Marker lab in google map?