1

I have SharpMap loading a shapefile and displaying the rendered image to a PictureBox.

If I open the shapefile in QGis I can see the SRC:

+proj=merc +lon_0=100 +lat_ts=-41 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs

However, when I tried to convert to Webmercator using SharpMap, the map renders empty. This is the code I use to re-project (data is the shapeFile object):

    ICoordinateSystem sourceTransform = data.CoordinateSystem;

    ICoordinateSystem webmercator = ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator;

    CoordinateTransformationFactory ctFac = new CoordinateTransformationFactory();

    ICoordinateTransformation transform = ctFac.CreateFromCoordinateSystems(sourceTransform, webmercator);

    vectorLayer.CoordinateTransformation = transform;

I also tried using different WKT, such as

PROJCS[""WGS_1984_Web_Mercator"", GEOGCS[""GCS_WGS_1984_Major_Auxiliary_Sphere"", DATUM[""WGS_1984_Major_Auxiliary_Sphere"", SPHEROID[""WGS_1984_Major_Auxiliary_Sphere"", 6378137.0, 0.0]], PRIMEM[""Greenwich"", 0.0], UNIT[""Degree"", 0.0174532925199433]], PROJECTION[""Mercator_1SP""], PARAMETER[""False_Easting"", 0.0], PARAMETER[""False_Northing"", 0.0], PARAMETER[""Central_Meridian"", 0.0], PARAMETER[""latitude_of_origin"", 0.0], UNIT[""Meter"", 1.0]]

... but there's no transformation at all.

How can I create this transformation?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.