[mapguide-users] Transform problem

vd vd at plan-online.info
Wed Jun 22 06:09:52 EDT 2011


Hi,

i was wondering that transformed linestrings disappeared since i've upgraded
to MG 2.2 and found out this:

The same code returns different results:

MGOS 2.1
source linestring:
LineString LL: 9.7800051 52.3522099
LineString LL: 9.7816462 52.3522538
LineString LL: 9.7816569 52.3521009
LineString LL: 9.7816918 52.3516089
transformed linestring:
LineString EPSG:31467: 3553219.266342479 5802380.451569846
LineString EPSG:31467: 3553331.0315552694 5802386.543996431
LineString EPSG:31467: 3553331.9445473156 5802369.538503741
LineString EPSG:31467: 3553334.9143957333 5802314.8187593445

MGOS 2.2 
source linestring:
LineString LL: 9.7800051 52.3522099
LineString LL: 9.7816462 52.3522538
LineString LL: 9.7816569 52.3521009
LineString LL: 9.7816918 52.3516089
transformed linestring:
LineString EPSG:31467: 5802380.451530828 3553219.266341531
LineString EPSG:31467: 5802386.543957413 3553331.03155432
LineString EPSG:31467: 5802369.538464721 3553331.9445463656
LineString EPSG:31467: 5802314.818720326 3553334.914394784


Source-Code:

MgGeometryFactory geometryFactory = new MgGeometryFactory();
MgCoordinateCollection coords = new MgCoordinateCollection();
for (int i = 0; i < Coords.length; i++)
{
	coords.Add(geometryFactory.CreateCoordinateXY(new Double(Coords[i].split("
")[0]),new Double(Coords[i].split(" ")[1])));
}
MgLineString ls = geometryFactory.CreateLineString(coords);
MgCoordinateIterator coordsit = ls.GetCoordinates();
while(coordsit.MoveNext()) {
	logger.debug("LineString LL: " + coordsit.GetCurrent().GetX() + " " +
coordsit.GetCurrent().GetY());
}

MgCoordinateSystemFactory coordSysFactory = new MgCoordinateSystemFactory();
MgCoordinateSystem source = coordSysFactory.Create(EPSG4326);
MgCoordinateSystem target = coordSysFactory.Create(map.GetMapSRS());
MgCoordinateSystemTransform transform = coordSysFactory.GetTransform(source,
target);
transform = coordSysFactory.GetTransform(source, target);

MgLineString ls2 = (MgLineString)ls.Transform(transform);
MgCoordinateIterator coordsit2 = ls2.GetCoordinates();
while(coordsit2.MoveNext()) {
	logger.debug("LineString 31467: " + coordsit2.GetCurrent().GetX() + " " +
coordsit2.GetCurrent().GetY());
}

I think 2.1 was ok. or?

MGOS 2.2.0.5703 - java



--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Transform-problem-tp6503631p6503631.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list