[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[udig-devel] First (of many) reproject question
|
Hi CRS guys I have a question / testcase for you ... the code is at the
end of this message.
In short I am getting very different results from the Postgis
transformation code - I am sure we went over this
back in the spring. I recall at the end of the day we got both systems
returning with in 10cm of each other so
I am probably doing something wrong. The epsg.properties file being used
was generated from PostGIS so
the WKT definitions they are working from should be identical.
Now the answer may be one of:
0) I messed up
1) Switch over to the CRS system
2) The old CS objects no longer work, or parse WKT differently
4) The epsg.properties file is some how wrong
If I messed up on this one I really would like to fix things as soon as
possible because all DataStores, Lite renderer and UDIG
are funneling through the CRSService API. It may be that CRSService
wants to go and live next to all the other CRS code,
it operates as a Facade for that module after all....
Jody Garnett
------------------------
public void testTranform() throws Exception {
CoordinateSystem bc = service.createCoordinateSystem("EPSG:42102");
CoordinateSystem latlong =
service.createCoordinateSystem("EPSG:4269");
MathTransform transform = CRSService.reproject( bc, latlong, true );
// origional bc alberts
Polygon poly1 = poly( new double[] {
1187128,395268, 1187128,396027,
1188245,396027, 1188245,395268,
1187128,395268} );
// transformed
Polygon poly2 = poly( new double[] {
-123.470095558323,48.5432615620081,
-123.469728946766,48.5500959221152,
-123.454638288508,48.5497352036088,
-123.455007082796,48.5429008916377,
-123.470095558323,48.5432615620081} );
Polygon polyAfter = CRSService.transform( poly1, transform );
System.out.println( "expected:"+ polyAfter );
System.out.println( "expected:"+ poly2 );
//assertEquals( poly2, polyAfter );
Envelope before = poly1.getEnvelopeInternal();
Envelope after = CRSService.transform( before, transform );
assertEquals( poly2.getEnvelopeInternal(), after );
}
----------------------
Here is the output:
actual:POLYGON ((-123.47009555832284 48.54326156200811,
-123.46972894676578 48.55009592211517, -123.45463828850829
48.54973520360885, -123.4550070827961 48.54290089163769,
-123.47009555832284 48.54326156200811))
expected:POLYGON ((-123.470095558323 48.5432615620081, -123.469728946766
48.5500959221152, -123.454638288508 48.5497352036088, -123.455007082796
48.5429008916377, -123.470095558323 48.5432615620081))
actual:Env[-138.4474639892578 : -138.4474639892578, 44.199676513671875
: 44.199676513671875]
expected:Env[-123.470095558323 : -123.454638288508, 48.5429008916377 :
48.5500959221152]