Google Maps Geocoder: Reference Position for Plain Location Names - google-maps

I'm using the google maps api for geocoding addresses. If I geocode a plain location name (e.g. Munich) the api returns corresponding latitude and longitude.
To which position do these coordinates refer to? Is it the (geographical) center of the location or the position of the administrative headquarter or what else?

They refer to the equator which is latitude=0° and the prime meridian which is longitude=0°. This represents the central point (starting point).
You can look at it as to the Cartesian coordinate system starting from (0,0)=(x,y) and retrieving all the other places by changing the x(long) and y(lat) coordinates. So yes, the answer is geographical centre.
EDIT:
url (video): https://www.youtube.com/watch?v=Spel7vfkpNc starting at 2:43
Basically, companies within the country decide on which lat, long will a city, country when searched appear. For example if you are searching for London the pin point will be assigned to particular coordinates depending on the company decision.

Related

Find city radius

I am working on an app where I need to check if some points are within a city or X km outside of it, so I need to find the city's radius then add the X variable to it. I've been looking on Google Maps and OpenStreetMap and I could not find such info.
Is there any API that provides the city's average width? Or distance between the center and the edge?
Based on the Latitude & Longitude of two given points, you can find the distance between those points.
So fetch the Location (Latitude & Longitude) for the centre of city and the point needed, using Google Maps API's and find out the distance implementing the logic.
Logic is described in below link :
http://www.movable-type.co.uk/scripts/latlong.html
Post calculation of distance, you verify if it is in the required range based on X.
I came across the same problem and here is the best method I found so far,
Using the service Geoapify
you can find the placeid for a city using the geocoding API
We can then create a location filter based on the place id as documented here
we can also use that filter for autocomplete to allow only for places inside the city

Finding the location in google maps

We have been using google maps api , but have a clarification. Is there any method which allows the user to know the nearest city as in when the user moves the mouse over the map .
Like the user hovers over the map from one country to another country, so is there any way to display the city name outside the map through an event.
I am aware that it is possible to get the user's current location through geolocation propertY, but is it possible to get the requirement described above ?
For what I know I can use reverse geocoding to obtain the designation of a place where you are based on its coordinates. At this point the problem is to define what you mean by the nearest town, you mean the center of the city where you are or drawn a town bordering the town where you are. In the first case using the name of the city you've got you can find with normal geocoding coordinates of the center of this city, in the latter case you have to develop a specific strategy.

Check if coordinates lie in a region

If I have a (latitude,longitude) pair, is there a way to determine whether it lies in a 'region'. By region I mean the 'highlighted' result of an query in google maps. For example, when I search for Manhattan, a red region is highlighted. Does Google/Bing provide an API to query if a given coordinate lie in such a region?
I am aware of the containsLocation API call that tells me if a coordinate lies in a polynomial already defined as a set of coordinates. The problem here is me not having all the coordinates that can define Delhi
Bing Maps provides an API called the GeoData API where you can pass in a coordinate and it will return the boundary information for the intersecting location (city in this case). https://msdn.microsoft.com/en-us/library/dn306801.aspx
Another method as mentioned by others in the comments is to use a reverse geocoding service. By passing in your coordinates it will return the name of the city in which that coordinate is in. Bing Maps also has a Reverse Geocoding service:
https://msdn.microsoft.com/en-us/library/ff701710.aspx

How to get the center coordinate of the map(Ext.map) in sencha touch 2?

I use an Ext.Map to let a user choose a certain place and I want to get the coordinate (or the coordinate of the map center) that user chooses. Which method should I use? I can't find a proper one in the doc.
Check out my answer to similar question given here. This will give you an idea.
How Can I Get marker on current location in map in Sencha-Touch2.0
EDIT:
To obtain the position co-ordinates ( i.e latitude and longitude) from the textual address, you will need to use Google Maps Geocoding API
Geocoding is the process of converting addresses (like "1600
Amphitheatre Parkway, Mountain View, CA") into geographic coordinates
(like latitude 37.423021 and longitude -122.083739), which you can use
to place markers or position the map.

how to determine house/block number, from gps coordinate

Is it possible to extract the exact location of a marker on a map? If I know that the marker is placed at (x,y) coordinate, With google maps I can see what street that is, but can I also get the huse number, or some more detailed address?
The answer is Yes and No.
The Google Maps API geocoder will reverse geocode a location to an address, and that may well do exactly what you want. Or it may not: geocoding is not an exact science and some guesswork might be involved.
Google does have "rooftop" data for some areas, and if that's the case the data will indicate "Rooftop" and provide the exact address.
In other places the address is found by interpolation -- Number 2 is at one intersection, Number 100 is at the next intersection, so a location which is at 60% of the distance between the junctions is... number 60, right? Maybe. But it's a reasonable guess and likely to be right.