How to create a grid overlay of earth? (I.e., ignoring the circular shape of earth when calculate coordinates) - google-maps

I am working with an application that dumps the latitude/longtitude coordinates into my database. My goal is to apply a grid layout to the earth (using Google Maps), group the coordinates together and update the correct grid cell. However, I am stuck with regards to how to create the grid overlay.
All the formulas I have found (for example here or the Google Maps computeOffset) take the earths shape into consideration. When using these formulas to calculate the coordinates for the grid cells, the lines naturally becomes skewed as the distance increases. My question is therefore, is there a formula for calculating latitude/longtitude that ignores the shape of the earth (where the input is a set of coordinates, bearing and length in meters)? I.e., what I want to achieve is:
If I have a point (0,0) and I want to find the position that is 100m to the east, I want the formula to return (latitude_offset_100m,0). Using a formula which considers the circular shape of the earth, this might give for example (latitude_offset_100m,longtitude_offset_5m).

I finally figured out how to achieve what I wanted. By using rhumb lines, you can get "straight" lines on a Mercator projected map (like Google maps).

Related

Heat map visualization for discrete values on Google Maps

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.

Google Maps - Create a polygon around existing markers

I dont know if this is possible but I use a google map to plot out positions of entities via markers on an overlay. I would like to be able to create a polygon or some other sort of overlay object around all the created markers, highlighting the extent of the markers, sort of a catchment area diagram. I wont know before all the markers are retrieved from the database and mapped what the extent is.
Anyone have any ideas how to approach this..?
Thanks
I think you are looking for the Convex Hull of the points
In mathematics, the convex hull or convex envelope of a set X of points in the Euclidean plane or Euclidean space is the smallest convex set that contains X. For instance, when X is a bounded subset of the plane, the convex hull may be visualized as the shape enclosed by a rubber band stretched around X.
Example using the Google Maps API v3 on a random set of points

calculate google maps GPS coordinates based on image size at a zoom level

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.

How to draw Google Maps circle overlays with fixed radius?

I'm using Google Maps API v3 to draw circle overlays at specific locations (latitude and longitude) provided by user via text field (simple HTML and JavaScript). The problem is, when I input different latitudes and longitudes, the size of the overlay circle changes. Even though I've provided a fixed-radius for the circles. I don't know how to fix this problem. I've tried using "scale" instead of "radius" but was unable to do so.
Due to the projection used by the google maps API the same radius will appear different sizes at different latitudes. Do you need a fixed radius or a fixed size in pixels? They are not the same.
For a fixed pixel size circle see the answer here
(from the "Related" questions on the right)

How to solve discrepancy between 3rd party coordinates and google map?

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%.