views:

122

answers:

1

I'm just getting myself to familiarize with GIS but i like to know before hand if the following is feasible with current GIS apps/tools...

  1. I get the point for an address by geocoding. Easy part.
  2. Now if the point falls within a boundary (may be a city/county/state) then i need to get the data (any id/flag) associated with the boundary.
  3. Based on the id/flag i then apply some business logic.

My question is...

  1. How do i define the boundary? What tools should i use for it?
  2. How can i store the boundary definition in database in order to check if the point falls within it? This has to be done in the back end and not in visual maps as we don't intend to show/use maps.
  3. How do i associate my custom data (id/flag) with the above boundary definition?

Hope i'm having right assumption on capabilities of GIS. Most of examples what i see is around people trying to show maps with data which is exactly not what i'm looking for. Also please suggest me some tools/books on this.

+3  A: 

How do i define the boundary? What tools should i use for it?

The boundary could be (and probably is) a shape (polygon, multipolygon) which you can provide in any current GIS-format. You will need to think about the projection and the datum you provide this in.

How can i store the boundary definition in database in order to check if the point falls within it?

Use PostGreSQL and it's spatial extensions (Postgis). Import the polygon from (1) into the database (for example with FWTOOLS ogr2ogr). This will yield you a nice geometry field in a table on which you can use the nice Postgis geometry functions in standard SQL fashion (St_Intersects would be appropriate here: finding out if the point geographically 'intersects' with our polygon, or you could use ST_Within to find out if the point falls well withing the polygon)

How do i associate my custom data (id/flag) with the above boundary definition?

Simply add an extra column to the table where the geometry is stored.

ChristopheD
Actually, ST_Intersects and ST_Within are the same when checking a point against a polygon. But yes, this is the way to go. Do make sure you understand the GIS concepts of projection and datum, as they do still apply in the database.
Andrew McGregor
Perfect that answers exactly what i was looking for. As i started this journey i figured out that i need some basics on the GIS and found this one around datum and projections http://www.utsa.edu/lrsg/Teaching/ES2113/L4_projection.pdf. Very helpful.
Gnu Engineer
+1. I would also mention that you could use any spatially-enabled database, in a similar way to the use of Postgis in this answer. For instance SQL Server and MySQL have built-in spatial extensions (in the later versions).
MarkJ
As Andrew says, make sure the coordinates used in your boundary are compatible with the coordinates used in your geocoding. Otherwise you're going to get the wrong answers when you query whether the point "intersects" the polygon. It's worth learning a little bit about this - you could start here http://www.sharpgis.net/post/2007/05/05/Spatial-references2c-coordinate-systems2c-projections2c-datums2c-ellipsoids-e28093-confusing.aspx
MarkJ