[Gdal-dev] GDAL Capabilities
Chapman, Martin
MChapman at sanz.com
Wed Jan 21 12:56:32 EST 2004
Patrick,
One note on using those functions. If you have a polygon that crosses the DateLine (180, -180) you need to add 360 to every lon or x point that is negative in order to project the point into positive XY space. This is accomplished easily if you're using an stl vector to store your points. If you're using MFC let me know and I will send you a sample app that uses this intersection code and the windows GDI to graphically show the intersections. I use this app to test my intersection code....it's nice because you can quickly plug in test case scenarios and see if the work with the code.
Martin
-----Original Message-----
From: gdal-dev-admin at remotesensing.org [mailto:gdal-dev-admin at remotesensing.org <mailto:gdal-dev-admin at remotesensing.org> ] On Behalf Of Chapman, Martin
Sent: Wednesday, January 21, 2004 10:04 AM
To: gdal-dev at remotesensing.org; gdal-dev at remotesensing.org
Subject: RE: [Gdal-dev] GDAL Capabilities
Patrick,
You can also write your own IsPointInPolygon() and IsLineInPolygon() functions very easily. I can send you the code if you like, but you will still need a lib to open the vector files to get a hold of the shape geometry. Also, you could link to the OpenGL library and use the gluPickMatrix() function to determine intersection of polygons. You need to know how to use OpenGL but it's spatial query functions (collision detection) are very powerful because it can do 3D intersection as well as 2D. Just a thought.
Martin
-----Original Message-----
From: Tyler Mitchell [mailto:TMitchell at lignum.com <mailto:TMitchell at lignum.com> ]
Sent: Wed 1/21/2004 9:48 AM
To: gdal-dev at remotesensing.org
Cc:
Subject: Re: [Gdal-dev] GDAL Capabilities
> program to generate a dynamic polygon based on lat/lon points input
> by the user
> and determine which polygons on a shapefile (us counties) fall within or
> intersect this dynamic polygon. A simple check to see if the county
> polygons in
> the shapefile fall within or intersect the dynamic polygon.
Patrick,
I'll take a kick at an answer, then others can correct me or fill in the
gaps.
I would say a general "yes" to your question and would highly recommend
GDAL library for the task. If there are holes in the functionality for
your specific task, there are bound to be other options (i.e. using the
PostGIS spatial database would allow you to do everything you want, all
using SQL within a database. You should consider that as well. See
http://postgis.refractions.net <http://postgis.refractions.net/> ).
You can program with GDAL (or more specifically, OGR, the vector subset of
the GDAL libraries) to create new datasources and create features
programmatically. I could envision how I would do this, receiving a list
of vertices/points in sequential order from the user. Then building a
polygon feature with these. You could then open the county polygons file
too.
The only part I'm not sure of is GDAL/OGR's abilities to do geometric
comparisons between features. I bet it's there somewhere but I haven't
touched it yet.
Also note that I work primarily in Python which has hooks into the c++
library. Being an ArcInfo guy myself, I've found Python to be as intuitive
as AML and much more fun than VB :)
For what it's worth,
Tyler
_______________________________________________
Gdal-dev mailing list
Gdal-dev at remotesensing.org
http://remotesensing.org/mailman/listinfo/gdal-dev <http://remotesensing.org/mailman/listinfo/gdal-dev>
_______________________________________________
Gdal-dev mailing list
Gdal-dev at remotesensing.org http://remotesensing.org/mailman/listinfo/gdal-dev <http://remotesensing.org/mailman/listinfo/gdal-dev>
More information about the Gdal-dev
mailing list