Perhaps you need the same point added at the start and end of your polygon, but 
the exception you get seems to be about something else. Please can you send 
more details about that.

Thanks for using GeoTools.

Andy

http://www.geog.leeds.ac.uk/people/a.turner/index.html

----- Reply message -----
From: "Claus Näveke" <geoto...@naeveke.de>
To: "geotools-gt2-users@lists.sourceforge.net" 
<geotools-gt2-users@lists.sourceforge.net>
Subject: [Geotools-gt2-users] Self-Intersecting Polygons
Date: Sat, Feb 7, 2015 18:43

Hi there,

I'm currently trying to get GeoTools working for me, but unfortunately I
am experiencing some trouble right at the beginning:
When importing data from an external source (so fixing the the input is
not an option) and trying to create a polygon out of it, I end up
getting "IllegalArgumentException: The curve segments are not simple,
but intersect" - The message is quite clear (and true), but how can I
work around it?

The code I'm currently using looks like this:

double[] in = new double[]{
    9.000, 48.000, 0,
    10.000, 48.000, 0,
    9.000, 49.000, 0,
    10.000, 49.000, 0
};

GeometryBuilder builder = new GeometryBuilder(DefaultGeographicCRS.WGS84 );
PointArray points = builder.createPointArray();
for(int i = 0; i < pointCount; i+=3){
    Point point = builder.createPoint(in[i], in[i+1]);
    points.add(point);
}

SurfaceBoundary surface = builder.createSurfaceBoundary(points);
Polygon polygon = builder.createPolygon(surface);

Is there a way to work with this input so I can use it as one (or more)
polygon? (I want to check whether a certain point is located inside
later on)

Thanks in advance
Claus

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to