Sorry, meant this to go to the list, I keep forgetting I have to use reply
all on this list, rather than just reply.
---------- Forwarded message ----------
From: Ryan Moquin <[EMAIL PROTECTED]>
Date: Wed, Nov 19, 2008 at 11:30 AM
Subject: Re: [Geotools-gt2-users] GeometryFactory in 2.5
To: Paulo Santos <[EMAIL PROTECTED]>
Thanks for the reply, Paulo.
I had found some examples using it, but I can't seem to figure out which jar
file actually contains the class. That's my issue...
On Wed, Nov 19, 2008 at 11:13 AM, Paulo Santos <[EMAIL PROTECTED]> wrote:
> /**
> * @param args the command line arguments
> */
> public static void main(String[] args) {
> try {
> GeometryFactory geometryFactory =
> JTSFactoryFinder.getGeometryFactory( null );
> WKTReader reader = new WKTReader( geometryFactory );
> Polygon polygon = (Polygon) reader.read("POLYGON((20000 10000,
> 20000 60000, 50000 60000, 50000 10000, 20000 10000))");
> Polygon polygon2 = (Polygon) reader.read("POLYGON((30000 20000,
> 30000 30000, 60000 30000, 60000 20000, 30000 20000))");
> Polygon polygon3 = (Polygon) reader.read("POLYGON((30000 40000,
> 30000 50000, 40000 50000, 40000 40000, 30000 40000))");
> Polygon polygon4 = (Polygon) reader.read("POLYGON((60000 40000,
> 60000 50000, 70000 50000, 70000 40000, 60000 40000))");
>
> System.out.println(polygon.getArea());
> System.out.println(polygon2.getArea());
> System.out.println(polygon3.getArea());
> System.out.println(polygon4.getArea());
>
> System.out.println(polygon3.getBoundary().within(polygon));
> System.out.println(polygon2.getBoundary().within(polygon));
> System.out.println(polygon4.getBoundary().within(polygon));
>
> System.out.println(polygon3.getBoundary().intersects(polygon));
> System.out.println(polygon2.getBoundary().intersects(polygon));
> System.out.println(polygon4.getBoundary().intersects(polygon));
>
> CoordinateReferenceSystem sourceCRS = CRS.decode("EPSG:4326");
> CoordinateReferenceSystem targetCRS = CRS.decode("SAD69");
>
> MathTransform transform = CRS.findMathTransform(sourceCRS,
> targetCRS);
>
> Geometry targetGeometry = JTS.transform(polygon3.getBoundary(),
> transform);
>
> System.out.println(targetGeometry.getCoordinates());
>
> // ReprojectPolygonDemo rpd = new ReprojectPolygonDemo();
> // rpd.demo(9);
> System.out.println("");
>
> } catch (TransformException ex) {
> Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null,
> ex);
> } catch (NoSuchAuthorityCodeException ex) {
> Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null,
> ex);
> } catch (FactoryException ex) {
> Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null,
> ex);
> } catch (MismatchedDimensionException ex) {
> Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null,
> ex);
> } catch (ParseException ex) {
> Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null,
> ex);
> }
> }
>
>
> 2008/11/19 Ryan Moquin <[EMAIL PROTECTED]>
>
>> Hello,
>>
>> I'm upgrading to geotools 2.5 and am having trouble figuring out which jar
>> contains JTSFactoryFinder. While searching to try to find out which, I ran
>> into a reply that Jody made regarding using "new GeometryFactory()". This
>> is actually what I was using in 2.4, is this the preferred way? Or is there
>> any reason I shouldn't go back to doing it that way?
>>
>> This is the reply I'm referring to:
>>
>> "I just had this problem reported and patches yesterday for trunk. I
>> think the developer is working on 2.5.x so perhaps they will commit for
>> the next release?
>>
>>
>>
>> - http://jira.codehaus.org/browse/GEOT-1979 JTSGeometryFactory failure
>> to resolve GeometryFactory
>>
>> For new new GeometryFactory() is the only way to go."
>>
>>
>>
>> Thanks,
>> Ryan
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Geotools-gt2-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>
>>
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users