Yea, there are a number of CRS in geotools that exist without transformations.

I spent a lot of time working on this problem, and although I'm sure it is not 
the best solution, the only way I really found to do it was to use ENU 
coordinates. I made a post about doing the conversion, but have not actually 
had time to add it to the library. You will need to do this conversion yourself.

Look up "[Geotools-gt2-users] Longitude Latitude to East North Up" to see the 
code that transforms from lat long to ENU, and then use the JTS polygons to do 
the testing on your ENU coordinates.

Fair warning, ENU is a local horizon and as such is most accurate close to the 
origin.

-Duane


-----Original Message-----
From: benjholla [mailto:[email protected]]
Sent: Wednesday, July 28, 2010 7:21 PM
To: [email protected]
Subject: Re: [Geotools-gt2-users] WGS84 Point in Polygon


Hello, I have been slamming my head against the wall for the past week trying
to do exactly the same thing.

I want to generate random points within the United States, I planned on
using the polygon features of JTS to do this operation, but I'm confused how
to create an accurate polygon from lat/lng points.  Did you ever find a
solution to this problem?  I would greatly appreciate any help.

I can't believe this is so hard, it seems like such a common problem that
many applications should have solved already.

I tried doing something like below, but there is no transformatin for this.

CoordinateReferenceSystem sourceCRS =
org.geotools.referencing.crs.DefaultGeographicCRS.WGS84;
CoordinateReferenceSystem targetCRS =
org.geotools.referencing.crs.DefaultEngineeringCRS.CARTESIAN_2D;

MathTransform transform =  CRS.findMathTransform(sourceCRS, targetCRS);
Geometry targetGeometry = JTS.transform(srcGeomotry, transform);

--
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/WGS84-Point-in-Polygon-tp5076094p5346547.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
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

------------------------------------------------------------------------------
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