Retrieve Google Polygons LatLng Coordinates - google-maps

When you search an area on Google Maps (eg.London) it shows you a highlighted polygon of London. What I need to do is to retrieve the LatLng coordinates of this polygon. Looking on Google's API Documentation I didn't find anything matching that need. Is it possible in another way/ workaround to do it?

With regards to the highlighted polygon (boundaries) like maps.google.com does, this is not yet available in Google Maps Platform APIs, however, there is a popular Feature Request with almost 400 stars in our Google Issue Tracker. I suggest you to star this feature request and to receive notifications about further updates of this feature. Here's the feature request Feature: Automatic polygon generation to specified geographic boundary (e.g. state, country).
On the other hand, you can check this documentation to get the latlng points of the polygon.
Hope this information find you helpful and good luck on your application!

Related

Google Autocomplete Polygon as GeoJson

I'm trying to find in the Google Maps documentation a way to search for a place and get it's GeoJson polygon but I got no luck finding something like that.
My goal is to create a search bar to search places and then send the geojson polygon to our back-end. I don't want to draw it on a map or anything front-related.
Nominatim is doing exactly what I want but Nominatim policy is very restricted so before I go for an alternative, I wanted to check if Google Maps could provide the same (especially since searching for a country on Google Maps retrieve the polygon and draw it on the map).
Thanks for your help !
Unfortunately Google Maps APIs don't expose any polygons data of geographic features. You can see very old feature request in the Google issue tracker to add this functionality, however it looks like Google didn't set high priority on this task:
https://issuetracker.google.com/issues/35816953
Feel free to star the public feature request to express your interest and subscribe to further updates from Google.
You should get polygons from other sources.

How google get polygon data for locality in a city

I have seen google showing polygon lines for locality in a map. eg: https://www.google.co.in/maps/place/Koramangala,+Bengaluru,+Karnataka/#12.9354922,77.6146828,14z/data=!3m1!4b1!4m5!3m4!1s0x3bae144ed898fc2d:0x1681f38e8c00ae56!8m2!3d12.9279232!4d77.6271078
I wanted to know how google gets this data. Do they use any kind of mapping of images to the government data available in the countries in the world. I dont think all the countries provide data (lats, longs) at such granular level.
Right now this feature is unavailable for Google Maps API. But there is a feature request on Google's Issue Tracker that you can star and comment on.
Here's the link:
https://issuetracker.google.com/35816953
There are workarounds for this though where you get the data elsewhere and draw the polygons yourself.
Here's the link to that:
Google Maps how to Show city or an Area outline

Is it possible to put a location marker on a google map without requesting it from the google server?

Really quick/simple question that will determine which map API i use for my project.
I dont need an example- ill figure that out, i just need to know if the capabilities are there.
If i have store geocode (latitude, longitude) coordinates in a database, can i put one of those little red markers on a google map without having to actually make a geocoding request from google?
Additional question:
Also, would it count towards any quotas every time i display one of their maps, even if i give them the geocoded coordinates? Because i mean technically their map still has to find those coordinates...
Q1: Yes — you tell the API the coordinates of where to put the marker, rather than get Google to find those coordinates.
Q2: The usage limits are published by Google. You can have up to 25000 map loads per day. If you don't use the geocoder because you provide the coordinates yourself, then you don't use a geocoder access.

Get type of terrain by coordinate

I'm looking for a solution to be able determine landscape type by a given coordinate, for example check if current position is water/forest/town/road and so on. I found google.maps.MapTypeStyleElementType object specification in the Google Maps specification, but not sure if it could help me or not.
Probably, there are some another Maps API with such functioality? Or maybe I should refer to the different types of offline maps?
Nope, the link you send is just for styling the proper features, not to tell which feature is at a given coordinate. If you are interested in landscape, then Corine Land Cover is the thing you are looking for. It describes the types of biotops like forest, water, but also land use - meadow, field, buildings etc. However, I don't know if there is such an online service where you could query particular coordinates. Other solution for you would be to import these GIS layers (they are freely available) to your own gis map server. Maybe this is partially solved as there are e.g. projects how to incorporate these into openstreetmap.
Well not quite, but you could get close to what you're looking for by using the Google Reverse Geocoder and the Google Places API
Google Reverse Geocoding
http://code.google.com/apis/maps/documentation/geocoding/#ReverseGeocoding
If you send the service a geocode it will send back an address type and/or one of several adress components http://code.google.com/apis/maps/documentation/geocoding/#Types
Google Places API
http://code.google.com/apis/maps/documentation/places/
You could use the Google places API to search for for what's near. If the geocode is in the middle of the lake, the Places API may return something like "Lake Michigan" and then you'd know the terrain obviously.

Topographical or relief data in Map APIs

I was wondering if anyone knew of any map APIs that offer topographical or relief data? I've had a quick look at Google and Bing APIs, but could find nothing there.
Google allow you to view a map as TERRAIN, which means you can see the topography of a map, but I want to be able to get at that data - i.e. if I were to draw a line between 2 points on Google Maps, I want to know how high above see level points along that line are.
Is this possible with any map APIs out there?
Thanks for your time!
Here's a simple example of height along a route.
I use USGS to obtain the elevation data, Google Maps API to plot the route and Google Charts to draw the elevation profile.
Full details in the associated tutorial.
Here are a few web services that provide elevation data:
USGS Elevation Query Web Service
EarthTools
GeoNames
Also, this site can search each of them