Hi all,

I'm not quite sure how to go about this, I have been playing with
geotools for about a week now trying to figure this out.  What I want
to do is randomly generate a WGS84 Lat/Lng point that is inside a
state boundary defined by the TIGER Shapefiles
(http://www.census.gov/cgi-bin/geo/shapefiles/national-files).

My idea is to try to create a JTS Geometry from the shapefile, and
then use the edge boundaries of the polygon to randomly create a
point, and then test if the point was inside the polygon until I got a
valid point.  (I know how to do this once I have a JTS Geometry, but I
don't know how to convert a shapefile to a JTS geometry)

My first approach was to convert all of the shapefile data to a KML
which is stored as a set of WGS84 lat/lng coordinate points, but I ran
into a mess of problems transforming the coordinates to a JTS polygon
(see thread [Geotools-gt2-users] WGS84 Point in Polygon).  I wondered
if I was approaching this wrong and because I am actually starting
with a valid shapefile, maybe I should try to work the shapefile
instead of WGS84 Coordinates?  If that's the case, how could I convert
the random point in the shapefile geometry to a WGS84 coordinate?

Can someone point me in the right direction?  Any example code would
be awesome!  I am still a bit unfamiliar with the Geotools library.

~Ben Holland

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to