Why does the Google Places API provide more Points of Interests (POI) by providing a smaller radius? The definition of radius is noted below:
radius — Defines the distance (in meters) within which to bias place results. The maximum allowed radius is 50 000 meters. Results inside of this region will be ranked higher than results outside of the search circle; however, prominent results from outside of the search radius may be included.
When using the API I get significantly more POIs by providing a radius of 50 vs. 200 meters. What is the "bias" that is mentioned in the definition above? Does anyone know how the radius meter search may translate to a zoom level when using Google Maps? Any information provided would be great. Thanks!
Related
I found this issue while experimenting with shapes. As written in documentation, we can draw circle with radius specified in meters. But Google Maps use cylindrical projection of the Earth (edit: ok, it doesn't), so logically, in Arctic regions our circles should be something similar to ellipse. So I conducted simple experiment and drew a circle near The Egde. That's the result:
As we can see, we still have a circle.
So, my question is, how Google Maps API calculates meters? Is there some constant coefficient between meters and coordinates, used consequently? Or maybe this is a bug and in all other cases one meter in Google Maps equals one meter in reality?
So, as I said in comment, the problem was my misinterpretation of the north edge of the map. When it comes to measuring, Google Maps API is reliable. This is how my 400-meters circle looks like near the real north pole:
I'm working on the following scenario: I have a geographical location and I need to create a heat-map visualization of travel times (by car) from that location to anywhere around. I'm planning on using Google Distance Matrix API for getting travel duration. But, since it has a limit on the no of API calls, I need to somehow limit the calls.
My plan, so far, is the following: compute the travel duration (basically a numeric value) to a set of points evenly distributed on a grid around the given position (e.g. 0.5km east, 0.5 km east-0.5km north, 0.5 km east-1 km north etc.). This points would represent the centers of square-shaped areas and I will consider the travel duration to the center as the travel duration to anywhere in the area. Display these areas as colored squares on a Google Maps in a heatmap style.
A good example of something that looks alike is this: http://project.wnyc.org/transit-time/#40.72280,-73.95464,12,709 .
So, my questions are:
Does it seem like a good strategy?
Is there a better visualisation strategy for something like this?
How can I create those square-shaped colored areas on Google Maps?
Thanks!
Calculating duration would surely involve traffic flow rather than simply distance. If your calculations are purely on distance you could use the Google Maps direction requests to calculate the distance to each point.
I'm not sure a heat map is the way forward for this scenario.
There a number of way you could achieve this. Here's a few:
a. Use a custom overlay
(https://developers.google.com/maps/documentation/javascript/examples/overlay-simple)
b. Draw polygons on the map and give them different colours based on
the journey duration. This would involve taking the area in question and slicing it up in to polygons however you need to. These polygons could take the same shape as your example. You would need to be rather precise with your latlng. SQL's spacial querys would help you here depending on the tech your using. (https://developers.google.com/maps/documentation/javascript/examples/polygon-arrays)
c. Depending on how specific you wanted to be you could draw circles with different radius value and different colours.
d. You could make custom markers in the shapes you require and add them to the map in the correct latlng in order to fill an area. You could have different markers for different duration and add them accordingly.
I'm sure there are other options as well.
Below is the map that captures from Google Map. I want to calculate the angle ABC. I have the coordinate (Latitude/Longitude) of three points.
Is there any approach to resolve my problem?
Thanks
You can find the heading between any two points using the google.maps.geometry.spherical.computeHeading method of the Google Maps Javascript API v3:
computeHeading(from:LatLng, to:LatLng) | number | Returns the heading from one LatLng to another LatLng. Headings are expressed in degrees clockwise from North within the range [-180,180).
The angle between the two will be the difference between the 2 headings.
Example using computeHeading in this answer
You can approximate the angle using the law of cosines. I say approximate because the curvature of the Earth is going to have some non-zero effect on the calculation.
In your example it should suffice to calculate the distances between the points and then perform the appropriate manipulations on the law of cosines. Refer to the second formula in the applications of the law of cosines wiki article and the corresponding picture.
I want to calculate the image dimensions in GPS coordinates scale based on a certain zoom level in google maps. Basically I want to find the distance between adjacent pixels in GPS coordinates scale.
How can I do this (what's the equation)?
You can find a class dealing with Mercator projection and tile size conversion here. You should be able to use a lot of these utility functions to compute this.
I have a set of coordinates data from 3rd party provider. However when I plot those coordinates on google maps with annotations, the annotated points are not exactly on the position they should be. For example, some points should be placed on the road, however they are placed slightly off the road.
My question is, how to solve this kind of discrepancy?
Thanks!
Coordinates (lat and long), by themselves, do not describe a position on the Earth. You need a third piece of information, called the datum. The datum for google maps is WGS84. The datum establishes such things as where 0,0 is on the Earth's surface.
If you've received coordinates, and those coordinates are based on a different datum, then they will not plot correctly on Google Maps.
On the other hand, if the points came from any kind of mobile device (even if it is using WGS84), there are inherent inaccuracies in such measurements (thankfully generally down to < 5m for GPS these days, I believe) that mean that they will not align 100%.