How to get all nearby roads in points specified radius? - google-maps

I have some latitude, longitude and radius in meters and i need to get all roads names in that radius... The nearest road i can get like this http://maps.googleapis.com/maps/api/directions/json?origin=55.685025%2c21.118995&destination=55.685025%2c21.118995&sensor=false&mode=driving. It would be in routes[0].legs[0].start_location. But is it possible to get all roads in 200 meters?
I also found this Google Maps: Given a point, how to find all points at a given road distance? in which on screen is show situation almost like mine, but the link is broken.

You can use the direction api when a road intersects the circumference. Then you can
subdivide the circle into smaller egments and feed it to the direction api. Here is an example:How do I calculate a point on a circle’s circumference?.

Related

Draw route and get distance from coordinates

we're working on a web app for fleet management.
We collect coordinates from vehicles and we would like to show a map with the "history" routes and the km traveled.
Problem is that the position sometimes is out of the road, so route API shows a strange route. This translates into a "drawn route" with a strange path and a lot of km more. Another problem is that the route is the one currently suggested, for example for work in progress
We are also trying to use polylines but that means that the line does not follow the road (ex curved road).
Do you have any suggestions?
thanks
See https://developers.google.com/maps/documentation/roads/snap for snapping the gps locations to the roads and interpolating the gps locations to account for roads that are not straight.

GMSCameraPosition: convert kilometers to zoom level

There is a way to convert a distance (in kilometers) into a float zoom level of a GMSCameraPosition?
I have an app where the user specifies a diameter (in kilometers) that he wants to see around the gps checkmark (his position). So, I need to convert that distance (like, 30 km) into a zoom level that fits that distance in kilometers.
I'm very new with Google Maps and didn't find a way to that until now.
Thanks in advance.
For calculating with GPS coordinates have a look here. (Especially the section "Destination point given distance and bearing from start point").
When you have your coordinates you can use the fitBounds-method of the Map-object which does exactly what you want.

Estimating the radius of a location using google maps

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

Displaying distance on an elevation graph when rendering directions

I would like to display an elevation graph within my application that also shows the distance from the start of a particular routes.
I found this example which shows a basic elevation graph for a route.
http://www.geocodezip.com/v3_elevation-profile_distance.html
Is there a way to accurately display the distance along the x axis in the graph at the bottom?
The fact that the google.maps.ElevationResult doesn't include a distance seems to make this very difficult.
Here's another example with driving directions and mileage in each county:
http://maps.forum.nu/v3/gm_directions.html
Is that what you're looking for?
The elevation service results contains the latitude/longitude coordinates, elevation and resolution of the result. From the coordinates you can compute the distance between the points (using the geometry library computeDistanceBetween method).

How to figure out the size of the area in a google maps window

I have a Map object created through the google maps api and I want to figure out the distance (km or mi) between the corners of the current view. I know how to get the coordinates of the corners, is there a utility function to calculate the distance between points?
From: http://code.google.com/apis/maps/documentation/reference.html#GLatLng
GLatLng.distanceFrom( other:GLatLng,
radius?:Number );
Returns the distance, in meters, from
this location to the given location.
By default, this distance is
calculated given the default
equatorial earth radius of 6378137
meters. The earth is approximated as a
sphere, hence the distance could be
off as much as 0.3%, especially in the
polar extremes. You may also pass an
optional radius argument to calculate
distances between GLatLng coordinates
on spheres of a different radius than
earth.
This somewhat depends on how accurate you need your answer to be.
The Google Maps API includes a function called distanceFrom, which will probably work just fine for you:
Returns the distance, in meters, from
this location to the given location.
By default, this distance is
calculated given the default
equatorial earth radius of 6378137
meters. The earth is approximated as a
sphere, hence the distance could be
off as much as 0.3%, especially in the
polar extremes. You may also pass an
optional radius argument to calculate
distances between GLatLng coordinates
on spheres of a different radius than
earth.
If you need a more accurate answer, you will need a function that takes the shape of the Earth into consideration. I haven't tried it, but this one looks great.