Skip to content

Coordinate problem with ProjectionMercator #88

Open
@helgekoch

Description

@helgekoch

The new 2D support is very nice. Thanks for this!

But unfortunately there seems to be a coordinate transformation issue probably related to the mercator projection. When I put a PointPlacemark into a 2D map using ProjectionMercator from a mouse listener the actual point of the icon on the screen seems to be systematically moved to the north (at least with german coordinates around 50.7, 7). This occurs also when moving the map around and when turning the map (the screen point is always shifted to the north). Since the distance shift seems to be constant this can best be seen using a small map scale.

There is no error when using ProjectionEquirectangular or ProjectionSinusoidal.

Version: 2.1.0

-- edit --
The following "pseudo" code produces coordinates with a distance error of around 50 meters.

`GeographicProjection projection = new ProjectionMercator();
double latitude = 50.7;
double longitude = 7.017;

    Globe globe = new EarthFlat();

    Vec4 offset = Vec4.ZERO;

    Vec4 v = projection.geographicToCartesian(globe, Angle.fromDegrees(latitude), Angle.fromDegrees(longitude), 0.,
        offset);

    LOGGER.info("v = {}", v);

    Position pos = projection.cartesianToGeographic(globe, v, offset);

    LOGGER.info("Position = {}", pos);
    
    double dist = new GeoPosition(latitude, longitude, 0.).getDistanceOnEllipsoid(new GeoPosition(pos.getLatitude().degrees, pos.getLongitude().degrees, 0.), WGS84.WGS84);
    LOGGER.info("dist = {}", dist);
    assertEquals(0., dist, 1.e-1);`

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions