I am using google maps API to get coordinates from a typed location. What I was also hoping to do was get the radius of the place, possibly using "bounds".
For example, if I geocode "England" it gives me a coordinate, but it doesnt tell me it's radius is very large. Whereas if I geocode "London" it again gives me a coordinate but doesnt tell me that it's radius is much smaller.
So my question is, is it possible to get an estimate of the size of the area being geocoded from the google API as well as it's center coordinate point?
Thanks!
You should be able to get the bounds via the GeocoderResult's geometry.bounds or geometry.viewport properties.
https://developers.google.com/maps/documentation/javascript/reference#GeocoderGeometry
Related
I am having an issue where some coordinates are providing correct streetview image while others are off by several lots. For example, the coordinates for 42.4025192834409,-83.1636018491871 in streetview bring me to the intersection nearby. If I enter those coordinates into google maps the pin location is correct but then I can't drag the streetview icon in that section. Is there anything we can do differently with our coordinates so that they go to correct location for streetview?
When I search for the address it works as you are seeking. I think this is the discrepancy you are experiencing:
https://developers.google.com/maps/documentation/streetview/intro
The Google Street View Image API will snap to the panorama photographed closest to this location. When an address text string is provided, the API may use a different camera location to better display the specified location. When a lat/lng is provided, the API searches a 50 meter radius for a photograph closest to this location.
You may want to try reverse geocoding.
Try again now.
https://maps.googleapis.com/maps/api/streetview?size=640x480&location=42.4025192834409,-83.16360184918&fov=90
When I read your question two days ago, it was actually getting the wrong panorama. I tried again today and it finally got the closest panorama to those coordinates. I guess it was an issue on Google's end.
I am new with using the Google maps geocoding API. I gave it an address and have a few different coordinates in the response. Why are there different coordinates?
More on Viewports: https://developers.google.com/maps/documentation/geocoding/intro#Viewports
"In a geocoding request, you can instruct the Geocoding service to prefer results within a given viewport (expressed as a bounding box). You do so within the request URL by setting the bounds parameter. Note that biasing only prefers results within the bounds; if more relevant results exist outside of these bounds, they may be included.
The bounds parameter defines the latitude/longitude coordinates of the southwest and northeast corners of this bounding box using a pipe (|) character to separate the coordinates."
Viewport allows you to create a boundary within a specific region, sort of like looking at a larger section of the map within a set of coordinates. Locations coordinates are giving you the exact spot of a location.
I have to find out whether a given lat/long value is with in a circle/rectangular area whose centre is some lat/long with some fixed radius.
is there any google maps API available for that ?
You can look at the documentation - containsLocation
Here is the link:
https://developers.google.com/maps/documentation/javascript/examples/poly-containsLocation
Is there a way to adjust the zoom Depending on the item searched, say if somebody searched on my application for a city/country/location, the viewport returned will be a bit higher than the city, So all of the city will be Included.
I know if you have several places you can do fitBounds(); but what if it's only one place like a location/country/city
Is there a way of setting the zoom a bit higher than that location?
Google's geocoder API returns the viewport coordinates of the searched object - see the documentation for an example. You can feed the viewport coordinates to the fitBounds method.
I would like to get a list of junctions' coordinates in a radius around a given coordinate. I figured there should be a way to extract the coordinates of wherever two roads meet, however I can't find it. Please advise!
That functionality is not available in the Google Maps API v3.