Simple GIS solution?

rm501

Active Member
Joined
Nov 30, 2009
Messages
88
Reaction score
3
Location
Johannesburg
Hi

I need a piece of software, that contains a map of South Africa. On it, there are defined zones (polygons demarcating areas in SA). When i feed in GPS co-ordinates, i need it to output which zone the location falls within.
I simply don't know how to achieve this.
Does one use and learn a full-blown GIS package for this simple task?
 
Do you need to plot these positions on a map? If you just need to know what zones they are in, and have some dev experience, you can code this up quickly, and overlay on google maps or OpenStreetMap.org for example.

If you don't have development skills, you would likely need a package or someone with some development skills.

If you do, here are some steps:
1. Search for a polygon intersection method (something along the lines of PointInPolygon). You will end up with a method where you define a polygon as a series of points (this will be a demarcating area), and ask it if a point exists within it. Calling the method with a point will return true or false.
2. For each point, run through all the polygons. If you get a true result, exit the loop.
3. You can also plot these on google maps / google earth or OpenStreetMap.org (both the demarcating areas and points) if you'd like.


EDIT: In terms of packages, you don't have to go the expensive route. SharpMap is an opensource solution that may do it for you: http://sharpmap.codeplex.com/
 
Last edited:
If you've got the polygons in in GPS coords too then you might get away with a pure calc (linear algebra style). I think you'd need an adjustment factor though since the earth isn't a perfect sphere.

Aside from ESRI there is also AfriGIS...did my vac work there and they've got tons of data & programmers.
 
Quantum Gis with the ftools plugin will be able to do this (albeit a bit cumbersome - will output results to shapefile, other plugins might do better) - both are free.
another free option is to use postgis + spatial queries.
 
If you've got the polygons in in GPS coords too then you might get away with a pure calc (linear algebra style). I think you'd need an adjustment factor though since the earth isn't a perfect sphere.

If his demarcation areas and points are in the same projections (it's likely they are both in WGS84 / EPSG 4326) then he wouldn't need to factor in anything, the projection would have taken any consideration of the earth's shape into account already. If the demarcation areas were rectangular, it would be as simple as "is the point's latitude within the upper and lower longitude of the rectangle, and the point's longitude within the rectangle's left and right longitude".

If it is a curved polygon, it becomes a little more difficult. In that case he needs a spatial method, of which the internet is flooded.

Something to note rm501: If you receive these demarcation areas from government, there is a chance that they are not in WGS84 projection, so just check that out. Our government often uses a local projection. I'm not sure how much you know about GIS, so i'll leave it there unless you ask for more info.
 
Quantum Gis with the ftools plugin will be able to do this (albeit a bit cumbersome - will output results to shapefile, other plugins might do better) - both are free.
another free option is to use postgis + spatial queries.

Or Sql Server and Spatial extensions:P It will be available in the express (free) version of Sql Server as well. STIntersects method on the SQLGeometry or SQLGeography classes if i'm not mistaken.
 
If his demarcation areas and points are in the same projections (it's likely they are both in WGS84 / EPSG 4326) then he wouldn't need to factor in anything, the projection would have taken any consideration of the earth's shape into account already. If the demarcation areas were rectangular, it would be as simple as "is the point's latitude within the upper and lower longitude of the rectangle, and the point's longitude within the rectangle's left and right longitude".

Projections are only relevant when plotting geodetic data (such as data in WGS84) onto a plane.
 
Projections are only relevant when plotting geodetic data (such as data in WGS84) onto a plane.

Actually they are relevant when doing any calculations between shapes. You cannot calculate whether a point is in a polygon unless they are on the same projection. In the geometry world this is a non issue as coordinates are in the same spatial reference. In the geography world, if two shapes (a point and a polygon in this case) are in different reference frames (projections) their coordinates mean completely different things. If I gave you a point that was in the spherical projection, and a polygon defined in WGS84, you would have to convert one to the other to determine whether the point was in the polygon.

This is the reason why in Sql Server spatial tools, when using the geography types, an exception will be thrown when performing a calculation with two shapes that are on different projections.
 
Nope, you are confusing projections with coordinate systems.

Ok, let me clarify, by projection I mean Projected Coordinate Systems, not map projection (hence my reference to EPSG4326 which is stated as the "EPSG Projection 4326" - http://spatialreference.org/ref/epsg/4326/).

Although not strictly true, many people refer to a coordinate system as a projection. I didn't realise you were trying to be that nit picky. I'll concede. I've just gotten used to it when talking with others over the net.

Negative. You can if they are either a) in the same coordinate system or b) you know how to tranform between coordinate system A and B.

Go back and replace "projection" (not strictly correct, but commonly used) with "coordinate system" (strictly correct) in my posts, and you will see that's exactly what I was saying.

Thanks for pointing out the incorrect term.
 
Last edited:
Thanks for the feedback.
So in principle i think i have it figured out.
I am using Quantum GIS to draw out the zones and fill in the attributes (the data will be mostly static, occasional changes)
I will then save it in that popular ESRI format.
I will then use SharpMap (http://sharpmap.codeplex.com) - as suggested by shogun,(thanks) - in my web app, to open the esri file and run a query with a set of co-ordinates to retrieve the zone data.

I have not yet tested it. But I think it will work.
 
Top
Sign up to the MyBroadband newsletter
X