|
From: Richard S. <ric...@ng...> - 2008-01-07 20:07:37
|
Since Geotools relies so heavily on JTS, is there any way to make it
accurately calculate the correct maximum Y value for a Geomety that
encompasses but does not contain the north pole? If not, how can I override
the envelope calculations?
For example, if I create a Polygon that contains the North Pole, my maximum
Latitude is 90. Below is a code snippet, that does just that. The max and
min values are both 85.
It seems that no matter what SRS I use, I will always run into this problem.
My largest (northernmost) point is not contained in any of the coordinates
that make up the polygon. Is there anyway around this limitation?
GeometryFactory gf = new GeometryFactory(new
PrecisionModel(PrecisionModel.FLOATING), 4326);
Coordinate[] containsNP = new Coordinate[5];
containsNP[0] = new Coordinate(-60, 85);
containsNP[1] = new Coordinate(160, 85);
containsNP[2] = new Coordinate(120, 85);
containsNP[3] = new Coordinate(-20, 85);
containsNP[4] = new Coordinate(-60, 85);
LinearRing exteriorNP = gf.createLinearRing(containsNP);
Polygon NPPolygon = gf.createPolygon(exteriorNP, holes);
Envelope env = NPPolygon.getEnvelopeInternal();
System.out.println("Here is the envelope of the polygon that crosses
180");
System.out.println("Min Y: " + env.getMinY());
System.out.println("Max Y: " + env.getMaxY());
--
View this message in context: http://www.nabble.com/Geotools%2C-JTS-and-the-North-Pole-tp14674535p14674535.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
|