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?
Related
I'm looking for a way to get the default heading in the Google Maps Streetview Embed with the same accuracy/heading as the static Streetview.
For a project I'm using the Google Maps static Streetview API to create a snapshot/front facing view of an address. The way I do this is to first find the address LatLng with the Google GeoCode API, using the full address (streetname+house_number+house_number_addition+zipcode+city). With the latLng I then call the Static streetview API to fetch a snapshot of this location.
https://maps.googleapis.com/maps/api/streetview?size=900x600&location={$latLng}&key={$key}"
As you can see there is no heading param specified so the API determines the best possible heading based on the given LatLng, as specified in the API docs.
The result is spot on for 99% of the cases, in which the house is almost perfectly centered in the streetview snapshot.
The Google maps streetview embed has a very different result. The steps leading up to the creation of the embed URL are identical (find the latlng based on the full address, and use the LatLng as the location in the embedcode)
https://www.google.com/maps/embed/v1/streetview?key={$key}&location={$latLng}"
resulting in the iframe HTML
<iframe src='{https://www.google.com/maps/embed/v1/streetview?key={$key}&location={$latLng}"}' width='600' height='450' frameborder='0' style='border:0;' allowfullscreen='' aria-hidden='false' tabindex='0'></iframe>
In this case the heading or camera direction is in many (not all) cases almost facing opposite of the targeted house. Of course this can be adjusted using the heading param, but it's strange that both streetview API's differ so much in the chosen heading.
After some more digging I found the answer here. The solution is to first use the Directions API to navigate to the given location, which sets the heading facing the location. Then use the getPanoramaByLocation method of the StreetviewService to determine the correct heading.
So instead of constructing the embed code serverside, the best approach seems to create the Streetview in the frontend using the Google Maps API.
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.
We have implemented Google Maps in an app for tourists but we want to provide seamless offline maps. We can generate these from the OSM data and we can even display these on the Google Maps with a negative zIndex which means they generally only show when the online map tiles are not available. However there are some issues with this approach:
1/ After going offline, for a while, Google Maps shows a very poor version of it's map (i.e. if you zoom in it is very blurry).
2/ As user moves around the map, sometimes the cached tiles (poor quality usually) show up and disappear.
3/ We can't control the zoom level when offline and so sometimes our map tiles won't be shown if the user zooms too much.
Ideally we'd like to be able to know if google maps can't load a tile so we could display our own. Is this possible? Or can we fix the above issues?
I'm importing a .kmz file into google maps, however google maps only displays a 2D projection of the path and seems incapable of displaying variation in altitude. Is that simply a limitation of the program, or is there a way to retrieve and present the height (typically displayed as a transparent vertical green rectangle with vertical yellow bars running through it in google earth)?
Thanks
KML has some limitations in Google Maps.
In particular, extrude element is not supported in Google Maps.
Reference: KML Elements Supported in Google Maps
https://developers.google.com/kml/documentation/kmlelementsinmaps
You could instead use the Google Earth API to embed Google Earth in a web page if that is what you want to do and maintain the 3-D look and feel.
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