I know that I can search for hotels(for example) nearby a node by giving the radius of circle from the center node using google places api. But this returns places which are in other city. The reason is geographically the place is situated within the given radius. But the driving distance differs. Is there anyway to get around this?
The Places Search API will return places within a specified area ranked by prominence (popularity; "rankby=prominence"), or ranked by distance ("rankby=distance") independent of area. There is no option to rank by driving distance.
To get a ranking based on driving distance, you may want to consider using the Places Search API in conjunction with the Distance Matrix API.
https://developers.google.com/maps/documentation/distancematrix/
The Distance Matrix API will return driving, walking, or bicycling distances based on one or more origin locations, and one or more destination locations.
Related
Using HERE Maps Api, for a geographic coordinate (lat, lng), I would like to find address information for the nearest routable road. Information that includes:
Address (street, house number, city, postal code, country)
Bearing/Heading of the road (0 to 360 degrees from True North)
How can I achieve this through HERE Maps API?
So far, this is what I have been able to achieve:
Calling the calculate Route API with identical start and end endpoints and mode=car will force the API to snap to the nearest routable point. This step is necessary for when the input coordinates are for a pedestrian street.
Using the nearest routable point coordinates, I can call reverse GeoCode API and I will be able to find the address information I need.
The next step is where I'm currently stuck. I'm able to find information like direction=NW, however I can't find the ~exact bearing in grad, for example bearing=265.
Is this achievable? Are 3 steps really necessary or is there a HERE Maps API endpoint that can provide all of this?
You can use the Fleet Telematics API to get the headings value for a particular road. Read more about the api here - https://developer.here.com/documentation/platform-data/topics/quick-start-view-map-data.html
You can also look at the field explanationshere - https://tcs.ext.here.com/pde/layer?region=WEU&release=19111&url_root=pde.api.here.com&layer=ADAS_ATTRIB_FC1
HEADINGS Horizontal road heading [10^-3 degree] at coordinate points along the link, when driving from Reference Node. Comma separated. Each value is relative to the previous. No values here for the ref/nonref nodes, because they are in the separate fields REFNODE_LINKCURVHEADS and NREFNODE_LINKCURVHEADS.
So I want to find different walking routes where the start and end destination is the same. So If I as a user choose 5km, maps would show me routes that are about 5km long and start and ends at the same location. I have looked through the (messy) maps apis but haven't managed to find any endpoints for doing this.
You can do something like that by adding waypoints. So for a 5km walk you could generate a random point within 2.5 km of your start/end point and add it as a waypoint when generating directions.
Edit:
In addition you may try using the Geometry library in the Google Maps API. There is a computeOffset function which returns the LatLng resulting from moving a distance from an origin in the specified heading (expressed in degrees clockwise from north). This way you can add some waypoints relative to the start/end point. Or in close proximity to the random first waypoint.
https://developers.google.com/maps/documentation/javascript/directions#Waypoints
I want to use some Google API to find a list of places within one hour from my location. I've found Google Maps Distance Matrix API but it only gives you the distance between places you specify.
What I really want to do is to paint an area in a map, I don't really need the list of places.
If I can't query by time maybe I can deal with distance (which is probably easier)
Thanks a lot!!
With the example below,
https://google-developers.appspot.com/maps/documentation/javascript/examples/place-search
I could get a list of stores nearby to pyrmont but i would also like to get the info of the store's distance from pyrmont and the approximate travel time by car & walk.
How could i get those info?
You'll probably want to use the Distance Matrix and/or Directions Service
Is there a way to determine which states are within circle overlays created by google.maps.Circle? Perhaps using reverse geocoding and getBounds or contains? Does Google provide a way to do this (using the geocoder or some other method), or must a database of Latitude and Longitude points of states be used?
There doesn't seem to be an easy way to do this within Google Maps API.
You can use getBounds() to get a LatLngBounds object approximating the circle. Note though that getBounds() will return a rectangle that approximates the circle, so you might get inaccurate results. To do it more accurately, you'd need to calculate a bunch of points to approximate the circle using something like the Haversine formula in combination with the cirlce's center and radius. The more points you calculate, the more accurate the approximation.
Once you have your set of bounding points, you're still not exactly out of the woods. There does not appear to be a way to use Google's Geocoder API to return all the states in a LatLngBounds. So you'd have to calculate a bunch more points within the bounds and send individual reverse geocode requests for them. And you still might miss a state or two. Overall, yuck.
Another approach, that doesn't seem that much more appealing to me, but who knows: For each state, get lat/lng data for a bunch of rectangular bounds that, when all combined together, approximate the shape of the state. For each state, use intersects() to see if it intersects with your circle.
There may be other possibilities, involving Google Maps API or other technologies, depending on your use case.