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
Related
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.
I have attempted to map some GPS coordinates (longitude / latitude pairs) onto an image of the region of the world that they correspond to. The math was not complicated simply offsetting and then transforming the numbers with a multiplier. However this worked fine for points in Australia, but not for points in New Zealand.
The result is that the points seem to drift south near the middle of the image then slowly correct before the bottom.
Is there some extra math which needs to be taken into consideration for plotting points on a map?
Note:
during my diagnostic excercise I placed my map over google maps and noticed that my version of Australia was different to google maps, but New Zealand was the same as google maps. But the plotting for Australia works but for New Zealand does not.
Longitude/Lattitude is spherical coordinatesystem and will only work if you have a globe to show your map on. In your case you have a flat map and need to project the coordinates onto a flat surface. The maps that Google uses is created with an Mercator-like projection.
What kind of projection you want to use depends on how big area your map consist of. Most countries have their own projection that fit best for their purposes.
Those transformations are quite tricky to work out by hand if your not a mathematician but there are good libraries for transformations like Dotspatial and GDal.
I have an App that displays thousands of Pin annotations on a google map using geo coordinates (lat/long in degree).
In some circumstances I would like to replace the Pin annotations with an overlay that will represent the shape of my geographical area covered by my thousands of Pin.
I'm looking for an algorithm where the input is the list of geo coordinate of my Pin annotations and the output will be an ordered list of geo coordinates that I will use to create the overlay on the google map. For sure the best would be java/objective-C code if it exists :-)
I looked on internet and found articles related to Graham convex hull algorithm but it seems not so easy to use and I don't know if it really works with Lat/Long?
Any help will be really appreciated.
Regards,
Sébastien.
i believe this is what you're looking for:
http://en.wikipedia.org/wiki/Gift_wrapping_algorithm
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).
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%.