Find cities within one hour from my location - google-maps-api-3

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!!

Related

Using Socrata API distance_in_meters() function with separate latitude, longitude field

I am trying to retrieve information about trees surrounding a given location from the Socrata API.
API Endpoint Description
I found two functions within_circle(...) and distance_in_meters(...) which I could use to filter the data set. The problem is, that those functions need either a location or a point data type which is not present in the data set.
There is, however a latitude and longitude field.
Is there any method to utilize those functions or get nearby trees other way?
Tried this, but POINT(0 0) must be the point of the tree.
https://data.cityofnewyork.us/resource/nwxe-4ae8.json?$where=within_circle( 'POINT(0 0)' ,0,0,400)
I need something like this.
https://data.cityofnewyork.us/resource/nwxe-4ae8.json?$where=within_circle( make_point(latitude, longitude) ,0,0,400)
SoQL
If you have not already done so, you may want to submit this question at https://support.socrata.com. In addition to the possibility that the people there will have an answer I do not, it would serve as some feedback that a function like what you had in mind would be useful.
I cannot think of a way to do exactly what you have in mind. Really, what I mean is a way that is within your power (or mine). The owner of the dataset could create a Point column -- and you may want to reach out to the NYC open data team to ask for that if you have not already done so.
However, since the X and Y coordinates, in feet, are present, you should be able to use the Pythagorean theorem to determine the distance from any given point. For that matter, the size of a degree of latitude or longitude cannot vary that much over an area as small as NYC so you could do the same thing with those values and save having to figure out the X and Y of your reference point.
Good luck!
Jon

How to retreive speed limit from here maps given a latitude and longitude?

I'm trying to get speed limit from Here API maps but I can't find the way to do it. I tryed few example on web site but the only one that works is the one which require point of start and point of stop of the route.
I would like to get the speed limit given only one point ( or a box ). Which api do I have to use? Is there an example?
https://route.cit.api.here.com/routing/7.2/calculateroute.json?jsonAttributes=1&waypoint0=51.31854,9.51183&waypoint1=50.11208,8.68342&departure=2019-01-18T10:33:00&routeattributes=sh,lg&legattributes=li&linkattributes=nl,fc&mode=fastest;car;traffic:enabled&app_code=appcode&app_id=appid
This is the waypoint one but is not what I'm looking for, I would like to pass it only a Latitude / Longitude.
Thank you
You can achieve this by using PDE API(Platform Data Extension)
You have to first map your geocordinates(lat,long) to a navigable position(lat,long) for the given coord and the Functional Class(FC1-5) it is located in. This you can achieve by a simple geocoder request
You can calculate tilexy values based on the navigable lat,long and pass it to PDE API for querying speed limit layer on that particular FC class.
Look at https://tcs.ext.here.com/examples/v3/link_speed_locator example which covers this exact usecase.
Below is a sample geocoder request. Here prox parameter is your lat,long
https://reverse.geocoder.cit.api.here.com/6.2/reversegeocode.json?app_id=xxxx&app_code=yyyy&prox=50.133848, 8.715332,500&mode=retrieveAddresses&maxResults=1&additionaldata=SuppressStreetType,Unnamed&locationattributes=linkInfo
Below is a sample pde request
https://pde.cit.api.here.com/1/tiles.json?layers=SPEED_LIMITS_VAR_FC1,SPEED_LIMITS_VAR_FC2,SPEED_LIMITS_VAR_FC3,SPEED_LIMITS_VAR_FC4,SPEED_LIMITS_VAR_FC5,ROAD_GEOM_FC1,ROAD_GEOM_FC2,ROAD_GEOM_FC3,ROAD_GEOM_FC4,ROAD_GEOM_FC5&levels=9,10,11,12,13,9,10,11,12,13&tilexy=536,398,1073,797,2147,1594,4294,3188,8588,6377,536,398,1073,797,2147,1594,4294,3188,8588,6377&app_id=xxxx&app_code=yyyy
Read more about it in the developer site - https://developer.here.com/documentation/platform-data/topics/quick-start-view-map-data.html
Hope you find this useful!
The ReverseGeocoder has rarely used mode "trackPosition" (mode=trackPosition).
In combination with locationattributes=linkInfo you may retrieve the speed limit for that matching road.

Maps API 3 Directions with fuzzy via co-ordinates

I have a number of GPS co-ordinates that describe a route. My intention is to draw a polyline along the route, and then colour segments based on some data I have.
Problem is, the GPS coordinates can occur on the roadside either side of main roads. When using the obvious Directions service solution a lot of "back and forth" occurs as Google tries to get me either side of a split lane road
What I am aiming for is a direct route from A-H passing through every way point. I have considered reverse geocoding the coordinates to a street name and having the directions use the street as a way point, but that picks a specific point on the street that may not be related to the actual route. Single polylines are also not an option as some routes have turns in them.
Is there a way to 'fuzzy' my waypoints so that the directions are happy when passing within a certain radius of the points? If not, has anyone got any other solutions?
Thanks heaps.
Edit: It's also not an option to just not use the middle way points because sometimes the path is not optimal.
Also have tried my own fuzzy coords now, by +- some small value to each consecutive lat/lng pair. Unsurprisingly I ran into OVER_QUERY_LIMIT pretty soon.

Finding streets (get their coordinates) and calculating distances between markers

I have trouble finding any information on how to use the API to:
Search for streets and get some clickable results that returns a LatLng object or something (at least coordinates). So If I search for a street and click on a result, I'll pan to that street (for example).
How can I calculate distance between markers? and possibly, draw lines between them.
All I get is the API but no guides so it's fairly hard figuring out what types to use.
Here is a fiddle showing how this can be achieved:
http://jsfiddle.net/foxwisp/vQGMr/1/
To convert street names to lat/lng you need to use a Geocoder such as the one provided by Google Maps API.
Then, when you get back the results from the geocode, you use the lat lng properties to create a marker. Once your first marker is placed, you repeat the process for your second street address. We nest these calls so that we can be assured of the order of execution due to their asynchronous nature.
Once we have our second marker we use Google's polyline function to draw a line between the two latlng marker points.
Then we use a slightly complicated mathematical equation to do some distance calculations and voila.
The Google Maps API is fantastically documented, hopefully this fiddle will put it into context for you and you can explore each element step by step by reviewing functions and properties in the documentation

How to nearby hotels using google places api based on driving distance

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.

Resources