views:

12

answers:

1

Hello,

my Application is given a list of Geocorrdinates and now I have to determine which of those Coordinates are inside a defined Area. For example the Search would definiton would be: Show me all Areas where 100 Coordinates are in an Area of 1km^2. So I have to find out which of these coordinates are together in Areas of 1km^2 and more than 100. But that seems to be a hard Job for my understanding of geocoordinates and I hope someone can help me with that.

The Latitude coordinates are consistent and Distance between two degrees is 111km. For example the Distance between N50,985° and N50,995° is 1,11km. The Distance between 2 Longtitude Coordinates is not so easy and depends on the Latitude coordinate. But to be honest, I really don't know how to start.

Does someone have an Idea and can help me?

Thank you

twickl

A: 

Hi,

what you need is a geospatial database, I'd recommend PostgreSQL with PostGIS. It provides the function you need to calculate this kind of stuff. Also search for good tutorials about it. An example is a radius search like "give me all McDonalds in a radius of 10km where I live"

sled
Uhh, the problem is that this must ran on an iPad / iPhone / mobile device without connecting to a backend. There must be a way to filter thos Coordinates in a way to know which of those are together in an defined Area :( I hope that my Problem is clear, I don't need to know which are in a particular area but which of them together lie in an area of e.g. 1km^2
twickl
does it have to be a "square/rectngle/polygon" ? Because doing a radius search would be much easier! Like "which points are at maximum x km away from me?" You could also do it in km^2 but with a circle too, if you have 4 km^2 this would be a circle with a radius of sqrt(4km^2/pi) then. If you have a set of points, try to eliminate as much as you can with as few calculus operations as possible. And then iterate through the rest and check if the euclidean distance is smaller or equal to the radius. This maybe pretty accurate for a few hundred or up to thousand miles ;)
sled
here's a good formula for calculating the distance between two WGS84 coordinates, http://www.movable-type.co.uk/scripts/latlong-vincenty.html
sled