Using Mapsui, how do I create a new transformation class for coordinate system read from shapefile prj...

In One Punch Man, is King actually weak?

How to get directions in deep space?

How to leave product feedback on macOS?

Determining multivariate least squares with constraint

El Dorado Word Puzzle II: Videogame Edition

How to write Quadratic equation with negative coefficient

If Captain Marvel (MCU) were to have a child with a human male, would the child be human or Kree?

Showing mass murder in a kid's book

Confusion over Hunter with Crossbow Expert and Giant Killer

Are Captain Marvel's powers affected by Thanos breaking the Tesseract and claiming the stone?

Quoting Keynes in a lecture

Alignment of six matrices

Make a Bowl of Alphabet Soup

Telemetry for feature health

Has the laser at Magurele, Romania reached a tenth of the Sun's power?

When and why was runway 07/25 at Kai Tak removed?

Would a primitive species be able to learn English from reading books alone?

Ways of geometrical multiplication

How to test the sharpness of a knife?

Why would five hundred and five be same as one?

Is there a distance limit for minecart tracks?

ContourPlot — How do I color by contour curvature?

Would this string work as string?

How to preserve electronics (computers, iPads and phones) for hundreds of years



Using Mapsui, how do I create a new transformation class for coordinate system read from shapefile prj file?


projection/pyproj puzzle, and understanding SRS formatogr2ogr failed to reproject shapefile error exceeds limitsproj.4 definition for Moscow GCS_Bessel_1841 to WGS84 convertionIn arcpy, if I subclass the arcpy Spatial Reference class, what is the object argument I would use in the subclass definition?QGIS reference system problemReprojecting vector layer from EPSG 3857 to 4326?How do I get imported KML circles to appear as circles rather than ellipses in QGIS?Converting CRS?Why are my vector layers with different CRS not aligning?Why is there a transformation shift/distortion of ~1.5km in OpenLayers 5.3.0 going from EPSG:4326 to EPSG:3857?













0















How do I create a new transformation class compatible with MapSui.Projections.ITransformation interface using ProjNet4GeoAPI that reads the source coordindate system from a prj file.



From Mapsui source code, there is a MinimalTransformation that implements ITransformation interface to convert between SphericalMercator and WGS84.



From Mapsui documentation :
The out of the box Mapsui support for projections is limited. The MinimalProjection class only projects between SphericalMercator (EPSG:3857) and WGS84 (EPSG:4326). It is however possible to create your own Transformation. You need to implement the ITransformation interface. Within this implementation you need to use some other projection library. A recommended one is ProjNet4GeoAPI.



I can create a working the transformation class with ProjNet4GeoAPI but it implements GeoAPI.CoordinateSystems.Transformations.ICoordinateTransformation not Mapsui.Projection.ITransformation



            // (FROM SOURCE) prj name: NAD_1983_StatePlane_Massachusetts_Mainland_FIPS_2001"
ICoordinateSystemFactory csFac = new ProjNet.CoordinateSystems.CoordinateSystemFactory();
string file = @"C:DRC_DataArcviewUSATownshipsNYTOWNS_POLY.prj";
string wkt= System.IO.File.ReadAllText(file);
var csFrom = csFac.CreateFromWkt(wkt);

//(TO) Prj name: "WGS 84 / Pseudo-Mercator"
file = @"C:DRC_DataArcview3857.prj";
wkt = System.IO.File.ReadAllText(file);
ICoordinateSystem csTo = csFac.CreateFromWkt(wkt);

//Step 2) Create transformation class.
CoordinateTransformationFactory ctFac = new CoordinateTransformationFactory();

//To 3857
//var is ICoordinateTransformation
ICoordinateTransformation ct = ctFac.CreateFromCoordinateSystems(csFrom, ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator);


How do I use the ICoordinateTransformation class with Mapsui?
Do I create a projection class like SphericalMercator in Mapsui.Projection
(see code below)?



From Mapsui.Projection:



public class MinimalTransformation : ITransformation
{
private readonly IDictionary<string, Func<double, double, Point>> _toLonLat = new Dictionary<string, Func<double, double, Point>>();
private readonly IDictionary<string, Func<double, double, Point>> _fromLonLat = new Dictionary<string, Func<double, double, Point>>();

public MinimalTransformation()
{
_toLonLat["EPSG:4326"] = (x, y) => new Point(x, y);
_fromLonLat["EPSG:4326"] = (x, y) => new Point(x, y);
_toLonLat["EPSG:3857"] = SphericalMercato.ToLonLat;
_fromLonLat["EPSG:3857"] = SphericalMercator.FromLonLat;
}








share



























    0















    How do I create a new transformation class compatible with MapSui.Projections.ITransformation interface using ProjNet4GeoAPI that reads the source coordindate system from a prj file.



    From Mapsui source code, there is a MinimalTransformation that implements ITransformation interface to convert between SphericalMercator and WGS84.



    From Mapsui documentation :
    The out of the box Mapsui support for projections is limited. The MinimalProjection class only projects between SphericalMercator (EPSG:3857) and WGS84 (EPSG:4326). It is however possible to create your own Transformation. You need to implement the ITransformation interface. Within this implementation you need to use some other projection library. A recommended one is ProjNet4GeoAPI.



    I can create a working the transformation class with ProjNet4GeoAPI but it implements GeoAPI.CoordinateSystems.Transformations.ICoordinateTransformation not Mapsui.Projection.ITransformation



                // (FROM SOURCE) prj name: NAD_1983_StatePlane_Massachusetts_Mainland_FIPS_2001"
    ICoordinateSystemFactory csFac = new ProjNet.CoordinateSystems.CoordinateSystemFactory();
    string file = @"C:DRC_DataArcviewUSATownshipsNYTOWNS_POLY.prj";
    string wkt= System.IO.File.ReadAllText(file);
    var csFrom = csFac.CreateFromWkt(wkt);

    //(TO) Prj name: "WGS 84 / Pseudo-Mercator"
    file = @"C:DRC_DataArcview3857.prj";
    wkt = System.IO.File.ReadAllText(file);
    ICoordinateSystem csTo = csFac.CreateFromWkt(wkt);

    //Step 2) Create transformation class.
    CoordinateTransformationFactory ctFac = new CoordinateTransformationFactory();

    //To 3857
    //var is ICoordinateTransformation
    ICoordinateTransformation ct = ctFac.CreateFromCoordinateSystems(csFrom, ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator);


    How do I use the ICoordinateTransformation class with Mapsui?
    Do I create a projection class like SphericalMercator in Mapsui.Projection
    (see code below)?



    From Mapsui.Projection:



    public class MinimalTransformation : ITransformation
    {
    private readonly IDictionary<string, Func<double, double, Point>> _toLonLat = new Dictionary<string, Func<double, double, Point>>();
    private readonly IDictionary<string, Func<double, double, Point>> _fromLonLat = new Dictionary<string, Func<double, double, Point>>();

    public MinimalTransformation()
    {
    _toLonLat["EPSG:4326"] = (x, y) => new Point(x, y);
    _fromLonLat["EPSG:4326"] = (x, y) => new Point(x, y);
    _toLonLat["EPSG:3857"] = SphericalMercato.ToLonLat;
    _fromLonLat["EPSG:3857"] = SphericalMercator.FromLonLat;
    }








    share

























      0












      0








      0








      How do I create a new transformation class compatible with MapSui.Projections.ITransformation interface using ProjNet4GeoAPI that reads the source coordindate system from a prj file.



      From Mapsui source code, there is a MinimalTransformation that implements ITransformation interface to convert between SphericalMercator and WGS84.



      From Mapsui documentation :
      The out of the box Mapsui support for projections is limited. The MinimalProjection class only projects between SphericalMercator (EPSG:3857) and WGS84 (EPSG:4326). It is however possible to create your own Transformation. You need to implement the ITransformation interface. Within this implementation you need to use some other projection library. A recommended one is ProjNet4GeoAPI.



      I can create a working the transformation class with ProjNet4GeoAPI but it implements GeoAPI.CoordinateSystems.Transformations.ICoordinateTransformation not Mapsui.Projection.ITransformation



                  // (FROM SOURCE) prj name: NAD_1983_StatePlane_Massachusetts_Mainland_FIPS_2001"
      ICoordinateSystemFactory csFac = new ProjNet.CoordinateSystems.CoordinateSystemFactory();
      string file = @"C:DRC_DataArcviewUSATownshipsNYTOWNS_POLY.prj";
      string wkt= System.IO.File.ReadAllText(file);
      var csFrom = csFac.CreateFromWkt(wkt);

      //(TO) Prj name: "WGS 84 / Pseudo-Mercator"
      file = @"C:DRC_DataArcview3857.prj";
      wkt = System.IO.File.ReadAllText(file);
      ICoordinateSystem csTo = csFac.CreateFromWkt(wkt);

      //Step 2) Create transformation class.
      CoordinateTransformationFactory ctFac = new CoordinateTransformationFactory();

      //To 3857
      //var is ICoordinateTransformation
      ICoordinateTransformation ct = ctFac.CreateFromCoordinateSystems(csFrom, ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator);


      How do I use the ICoordinateTransformation class with Mapsui?
      Do I create a projection class like SphericalMercator in Mapsui.Projection
      (see code below)?



      From Mapsui.Projection:



      public class MinimalTransformation : ITransformation
      {
      private readonly IDictionary<string, Func<double, double, Point>> _toLonLat = new Dictionary<string, Func<double, double, Point>>();
      private readonly IDictionary<string, Func<double, double, Point>> _fromLonLat = new Dictionary<string, Func<double, double, Point>>();

      public MinimalTransformation()
      {
      _toLonLat["EPSG:4326"] = (x, y) => new Point(x, y);
      _fromLonLat["EPSG:4326"] = (x, y) => new Point(x, y);
      _toLonLat["EPSG:3857"] = SphericalMercato.ToLonLat;
      _fromLonLat["EPSG:3857"] = SphericalMercator.FromLonLat;
      }








      share














      How do I create a new transformation class compatible with MapSui.Projections.ITransformation interface using ProjNet4GeoAPI that reads the source coordindate system from a prj file.



      From Mapsui source code, there is a MinimalTransformation that implements ITransformation interface to convert between SphericalMercator and WGS84.



      From Mapsui documentation :
      The out of the box Mapsui support for projections is limited. The MinimalProjection class only projects between SphericalMercator (EPSG:3857) and WGS84 (EPSG:4326). It is however possible to create your own Transformation. You need to implement the ITransformation interface. Within this implementation you need to use some other projection library. A recommended one is ProjNet4GeoAPI.



      I can create a working the transformation class with ProjNet4GeoAPI but it implements GeoAPI.CoordinateSystems.Transformations.ICoordinateTransformation not Mapsui.Projection.ITransformation



                  // (FROM SOURCE) prj name: NAD_1983_StatePlane_Massachusetts_Mainland_FIPS_2001"
      ICoordinateSystemFactory csFac = new ProjNet.CoordinateSystems.CoordinateSystemFactory();
      string file = @"C:DRC_DataArcviewUSATownshipsNYTOWNS_POLY.prj";
      string wkt= System.IO.File.ReadAllText(file);
      var csFrom = csFac.CreateFromWkt(wkt);

      //(TO) Prj name: "WGS 84 / Pseudo-Mercator"
      file = @"C:DRC_DataArcview3857.prj";
      wkt = System.IO.File.ReadAllText(file);
      ICoordinateSystem csTo = csFac.CreateFromWkt(wkt);

      //Step 2) Create transformation class.
      CoordinateTransformationFactory ctFac = new CoordinateTransformationFactory();

      //To 3857
      //var is ICoordinateTransformation
      ICoordinateTransformation ct = ctFac.CreateFromCoordinateSystems(csFrom, ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator);


      How do I use the ICoordinateTransformation class with Mapsui?
      Do I create a projection class like SphericalMercator in Mapsui.Projection
      (see code below)?



      From Mapsui.Projection:



      public class MinimalTransformation : ITransformation
      {
      private readonly IDictionary<string, Func<double, double, Point>> _toLonLat = new Dictionary<string, Func<double, double, Point>>();
      private readonly IDictionary<string, Func<double, double, Point>> _fromLonLat = new Dictionary<string, Func<double, double, Point>>();

      public MinimalTransformation()
      {
      _toLonLat["EPSG:4326"] = (x, y) => new Point(x, y);
      _fromLonLat["EPSG:4326"] = (x, y) => new Point(x, y);
      _toLonLat["EPSG:3857"] = SphericalMercato.ToLonLat;
      _fromLonLat["EPSG:3857"] = SphericalMercator.FromLonLat;
      }






      coordinate-system





      share












      share










      share



      share










      asked 5 mins ago









      Gary KindelGary Kindel

      1386




      1386






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "79"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f316189%2fusing-mapsui-how-do-i-create-a-new-transformation-class-for-coordinate-system-r%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f316189%2fusing-mapsui-how-do-i-create-a-new-transformation-class-for-coordinate-system-r%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Щит и меч (фильм) Содержание Названия серий | Сюжет |...

          is 'sed' thread safeWhat should someone know about using Python scripts in the shell?Nexenta bash script uses...

          Meter-Bus Содержание Параметры шины | Стандартизация |...