Hi Rueben,
thanks for your reply.
I have already created CRS's with an authority factory.
The created CRS returns the following informations with
"System.out.println(sourcecrs)":
> PROJCS["DHDN / Gauss-Kruger zone 2",
> GEOGCS["DHDN",
> DATUM["Deutsches_Hauptdreiecksnetz",
> SPHEROID["Bessel 1841", 6377397.155, 299.1528128,
> AUTHORITY["EPSG","7004"]],
> AUTHORITY["EPSG","6314"]],
> PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]],
> UNIT["degree", 0.017453292519943295],
> AXIS["Lon", EAST],
> AXIS["Lat", NORTH],
> AUTHORITY["EPSG","4314"]],
> PROJECTION["Transverse_Mercator"],
> PARAMETER["central_meridian", 6.0],
> PARAMETER["latitude_of_origin", 0.0],
> PARAMETER["scale_factor", 1.0],
> PARAMETER["false_easting", 2500000.0],
> PARAMETER["false_northing", 0.0],
> UNIT["m", 1.0],
> AXIS["x", EAST],
> AXIS["y", NORTH],
> AUTHORITY["EPSG","31466"]]
>
The problem is, that the BursaWolfParameter (TOWGS84[]) is missing!
The WKT should look like:
> PROJCS[\"DHDN / Gauss-Kruger zone 2\",
> GEOGCS[\"DHDN\",
> DATUM[\"Deutsches_Hauptdreiecksnetz\",
> SPHEROID[\"Bessel 1841\", 6377397.155, 299.1528128,
> AUTHORITY[\"EPSG\",\"7004\"]],
> TOWGS84[598.1, 73.7, 418.2, 0.2019999999999998, 0.04499999999999995,
> -2.4549999999999974, 1.3819742018555456],
> AUTHORITY[\"EPSG\",\"6314\"]],
> PRIMEM[\"Greenwich\", 0.0, AUTHORITY[\"EPSG\",\"8901\"]],
> UNIT[\"degree\",0.01745329251994328, AUTHORITY[\"EPSG\",\"9122\"]],
> AUTHORITY[\"EPSG\",\"4314\"]], PROJECTION[\"Transverse_Mercator\"],
> PARAMETER[\"latitude_of_origin\",0], PARAMETER[\"central_meridian\",6],
> PARAMETER[\"scale_factor\",1], PARAMETER[\"false_easting\",2500000],
> PARAMETER[\"false_northing\",0],
> UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],
> AUTHORITY[\"EPSG\",\"31466\"]]
>
Here are the TOWGS84[] parameters included!
But I have to do this manually....or does a library exist, which contains
the WKT "with" TOWGS84[] parameters?
Maybe a look-up table would be usefull....
I'm doing the following steps to transform a point (optionally I could
create the CRS by WKT):
> private Point2D.Double getPointAsLatLong(Point2D.Double point){
>
>
> CoordinateReferenceSystem sourcecrs =
> FactoryFinder.getCRSAuthorityFactory("EPSG",
> null).createCoordinateReferenceSystem("EPSG:31467");
> CoordinateReferenceSystem targetcrs =
> FactoryFinder.getCRSAuthorityFactory("EPSG",
> null).createCoordinateReferenceSystem("EPSG:4326");
>
> CoordinateOperationFactory coFactory = FactoryFinder
> .getCoordinateOperationFactory(null);
> CoordinateOperation op = coFactory.createOperation(sourcecrs,
> targetcrs);
>
> GeneralDirectPosition gdp = new GeneralDirectPosition(0, 0);
> gdp.setOrdinate(0, point.getX());
> gdp.setOrdinate(1, point.getY());
> op.getMathTransform().transform(gdp, gdp);
>
> outPoint.x = gdp.getOrdinate(0);
> outPoint.y = gdp.getOrdinate(1);
>
>
> return outPoint;
>
So, what's wrong?
Best regards
Sebastian
Rueben Schulz wrote:
>
> To Sebastian,
>
> Hi. You can get the towgs84 parameters you need from the EPSG database.
> The easiest way to do this is to use an authority factory to create a
> CRS from an EPSG code (31466 in your case). The returned CRS should have
> the towgs84 (BursaWolf) parameters included, which will be used to
> create the correct transformation.
>
> An example of how to create a CRS from authority codes can be found in:
>
> http://svn.geotools.org/geotools/trunk/gt/demo/referencing/src/main/java/org/geotools/demo/referencing/CTSTutorial.java
>
> Note, Zone 3 of your projection is given in the command line example at
> the end of:
>
> http://geotools.codehaus.org/Coordinate+Transformation+Services+for
> +Geotools+2.1
>
> so I expect that the EPSG database has the towgs84 parameters that you
> need.
>
> Rueben
>
>
>
>
>
> On Tue, 2006-12-12 at 04:18 -0800, Wegert wrote:
>> Hallo all,
>>
>> At the moment, I'm trying to project points, lines and polygons on
>> "Google
>> Earth". To achieve this aim, I'm using GEOTOOLS.
>>
>> Now to the problem:
>>
>> As Martin Desruisseaux wrote in his answer (
>> http://sourceforge.net/mailarchive/message.php?msg_id=15645183 ) you
>> can't
>> set Hints.LENIENT_DATUM_SHIFT to Boolean.TRUE, if you want an accurate
>> transformation.
>> For example, the projection from GK2 (Gauß-Krüger 2) to WGS84 (as far as
>> I
>> know this is the basis CRS of Google Earth) results in a deviation of
>> about
>> 200 metres, always. (btw: You can take a look at the screenshot in the
>> attachment!)
>>
>>
>>
>>
>> Here are some informations about the transformation:
>>
>> sourcecrs:
>>
>> PROJCS["DHDN / Gauss-Kruger zone 2",
>> GEOGCS["DHDN",
>> DATUM["Deutsches_Hauptdreiecksnetz",
>> SPHEROID["Bessel 1841", 6377397.155, 299.1528128,
>> AUTHORITY["EPSG","7004"]],
>> AUTHORITY["EPSG","6314"]],
>> PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]],
>> UNIT["degree", 0.017453292519943295],
>> AXIS["Lon", EAST],
>> AXIS["Lat", NORTH],
>> AUTHORITY["EPSG","4314"]],
>> PROJECTION["Transverse_Mercator"],
>> PARAMETER["central_meridian", 6.0],
>> PARAMETER["latitude_of_origin", 0.0],
>> PARAMETER["scale_factor", 1.0],
>> PARAMETER["false_easting", 2500000.0],
>> PARAMETER["false_northing", 0.0],
>> UNIT["m", 1.0],
>> AXIS["x", EAST],
>> AXIS["y", NORTH],
>> AUTHORITY["EPSG","31466"]]
>>
>>
>> targetcrs:
>>
>> GEOGCS["WGS 84",
>> DATUM["WGS_1984",
>> SPHEROID["WGS 84", 6378137.0, 298.257223563,
>> AUTHORITY["EPSG","7030"]],
>> AUTHORITY["EPSG","6326"]],
>> PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]],
>> UNIT["degree", 0.017453292519943295],
>> AXIS["Lon", EAST],
>> AXIS["Lat", NORTH],
>> AUTHORITY["EPSG","4326"]]
>>
>>
>>
>> Result of System.out.println(transform):
>>
>> CONCAT_MT[INVERSE_MT[PARAM_MT["Transverse_Mercator",
>> PARAMETER["semi_major", 6377397.155],
>> PARAMETER["semi_minor", 6356078.962818189],
>> PARAMETER["central_meridian", 6.0],
>> PARAMETER["latitude_of_origin", 0.0],
>> PARAMETER["scale_factor", 1.0],
>> PARAMETER["false_easting", 2500000.0],
>> PARAMETER["false_northing", 0.0]]],
>> PARAM_MT["Molodenski",
>> PARAMETER["dim", 2],
>> PARAMETER["dx", 0.0],
>> PARAMETER["dy", 0.0],
>> PARAMETER["dz", 0.0],
>> PARAMETER["src_semi_major", 6377397.155],
>> PARAMETER["src_semi_minor", 6356078.962818189],
>> PARAMETER["tgt_semi_major", 6378137.0],
>> PARAMETER["tgt_semi_minor", 6356752.314245179]]]
>>
>>
>> As you can see, the translation parameters "dx", "dy", "dz" are equal to
>> "0.0".
>>
>>
>> The coordinates of the given point (highlighted in the screenshot) in GK2
>> are:
>>
>> X: 2662992.3037465196
>> Y: 5543456.129133454
>>
>>
>> The results of GEOTOOLS for WGS84 are:
>>
>> X: 8.274064947588457
>> Y: 50.00686449018631
>>
>>
>> Though, the result has to be:
>>
>> X: 8.27317386543231;
>> Y: 50.0050926651181;
>>
>> I calculated this with "Postgres" and checked it visually and these are
>> nearly the correct coordinates ( < 2 metres)!
>>
>>
>> I need the general way for every kind of transformation from one chosen
>> coordinate system into WGS84...if it's possible.
>>
>> What should I set for the "BursaWolfParameter", which is required if I
>> won't
>> set Hints.LENIENT_DATUM_SHIFT to Boolean.TRUE and how does it work?
>>
>>
>> I would be grateful for every response....
>> Best regards
>> Sebastian
>>
>> http://www.nabble.com/file/4554/projection.JPG
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
--
View this message in context:
http://www.nabble.com/Google-Earth---Projection-tf2807194.html#a7851998
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users