Dear all,
I seem to have problems to build a JTS geometry using Geotools 
2.5.-snapshot.
I have an array of coordinates (printout below) that I extracted from a 
GML polygon exterior ring position list.Running the code below I am 
getting an invalid geometry. I tried to print out the geometry toText, 
and am getting the followng error from the toText method:
java.lang.NullPointerException
    at 
com.vividsolutions.jts.io.WKTWriter.createFormatter(WKTWriter.java:125)
    at 
com.vividsolutions.jts.io.WKTWriter.writeFormatted(WKTWriter.java:290)
    at com.vividsolutions.jts.io.WKTWriter.write(WKTWriter.java:226)
    at com.vividsolutions.jts.geom.Geometry.toText(Geometry.java:961)

Same thing happens on the linearring, which meant that the construction 
of the LinearRing is somehow incorrect. What could be the problem?
Thanks
Martin


GeometryFactory gf = new GeometryFactory(null,3035);
ArrayList<String> splitPos = splitString(poslist," ",2,",");
Coordinate[] coords = toCoordArray(splitPos, ",");
LinearRing shell = gf.createLinearRing(coords);
Polygon p = gf.createPolygon(shell, null);
p.setSRID(3035);
System.out.println("new pol: "+p.toText());

(4100527.55, 2546443.706, NaN)
(4101669.813, 2551297.031, NaN)
(4102440.967, 2551063.104, NaN)
(4103305.401, 2550601.054, NaN)
(4104063.084, 2549979.24, NaN)
(4104684.898, 2549221.557, NaN)
(4105146.948, 2548357.123, NaN)
(4105380.875, 2547585.969, NaN)
(4100527.55, 2546443.706, NaN)

-- 
Martin Tomko
Postdoctoral Research Assistant 
    
Geographic Information Systems Division
Department of Geography
University of Zurich - Irchel
Winterthurerstr. 190
CH-8057 Zurich, Switzerland

email:  [email protected]
site:   http://www.geo.uzh.ch/~mtomko
mob:    +41-788 629 558
tel:    +41-44-6355256
fax:    +41-44-6356848


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to