<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Netopology wkt for coordinates in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/netopology-wkt-for-coordinates/m-p/1008133#M5705</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/219831"&gt;@AndréGrce&lt;/a&gt;,&amp;nbsp; same question as &lt;A href="https://community.esri.com/t5/developers-questions/get-wkt-string-for-a-given-shapefile/m-p/1008050#M5703" target="_blank"&gt;Get wkt string for a given shapefile - GeoNet, The Esri Community?&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Dec 2020 17:22:44 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2020-12-09T17:22:44Z</dc:date>
    <item>
      <title>Netopology wkt for coordinates</title>
      <link>https://community.esri.com/t5/developers-questions/netopology-wkt-for-coordinates/m-p/1008093#M5704</link>
      <description>&lt;DIV&gt;I am trying to read coordinates from a shapefile. But I get wrong coordinates.&lt;/DIV&gt;&lt;DIV&gt;I am not sure if I use the correct wkt strings. Is there any function i can use to get the wkt string for a given shapefile?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I use these librarys:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;using NetTopologySuite.IO;&lt;/DIV&gt;&lt;DIV&gt;using ProjNet.CoordinateSystems;&lt;/DIV&gt;&lt;DIV&gt;using ProjNet.CoordinateSystems.Transformations;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;And this is my code:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CoordinateSystemFactory coordinateSystemFactory = new CoordinateSystemFactory();&lt;/DIV&gt;&lt;DIV&gt;string UTMWGS84_WKT2 = "PROJCS[\"WGS 84 / UTM zone 32N\", GEOGCS[\"WGS 84\", DATUM[\"WGS_1984\", SPHEROID[\"WGS 84\", 6378137, 298.257223563, AUTHORITY[\"EPSG\", \"7030\"]], AUTHORITY[\"EPSG\", \"6326\"]], PRIMEM[\"Greenwich\", 0, AUTHORITY[\"EPSG\", \"8901\"]], UNIT[\"degree\", 0.01745329251994328, AUTHORITY[\"EPSG\", \"9122\"]], AUTHORITY[\"EPSG\", \"4326\"]], UNIT[\"metre\", 1, AUTHORITY[\"EPSG\", \"9001\"]], PROJECTION[\"Transverse_Mercator\"], PARAMETER[\"latitude_of_origin\", 0], PARAMETER[\"central_meridian\", 9], PARAMETER[\"scale_factor\", 0.9996], PARAMETER[\"false_easting\", 500000], PARAMETER[\"false_northing\", 0], AUTHORITY[\"EPSG\", \"32632\"], AXIS[\"Easting\", EAST], AXIS[\"Northing\", NORTH]]";&lt;/DIV&gt;&lt;DIV&gt;CoordinateSystem source = coordinateSystemFactory.CreateFromWkt(@UTMWGS84_WKT2);&lt;/DIV&gt;&lt;DIV&gt;string UTMWGS84_WKT = "GEOGCS[\"WGS 84\"," + "DATUM[\"WGS_1984\"," + "SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]]," + "AUTHORITY[\"EPSG\",\"6326\"]]," + "PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]]," + "UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]]," + "AUTHORITY[\"EPSG\",\"4326\"]]," + "PROJECTION[\"Transverse_Mercator\"]," + "PARAMETER[\"latitude_of_origin\",0]," + "PARAMETER[\"central_meridian\",9]," + "PARAMETER[\"scale_factor\",0.9996]," + "PARAMETER[\"false_easting\",500000]," + "PARAMETER[\"false_northing\",0]," + "UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]";&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CoordinateSystem target = coordinateSystemFactory.CreateFromWkt(UTMWGS84_WKT);&lt;/DIV&gt;&lt;DIV&gt;CoordinateSystem target2 = coordinateSystemFactory.CreateFromWkt(UTMWGS84_WKT);&lt;/DIV&gt;&lt;DIV&gt;CoordinateTransformationFactory trf = new CoordinateTransformationFactory();&lt;/DIV&gt;&lt;DIV&gt;CoordinateTransformation tr = (CoordinateTransformation)trf.CreateFromCoordinateSystems(source, target);&lt;/DIV&gt;&lt;DIV&gt;var filename = @"C:\\myshapefile.shp";&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;using (var reader = new ShapefileDataReader(filename, NetTopologySuite.Geometries.GeometryFactory.Default))&lt;/DIV&gt;&lt;DIV&gt;{&lt;/DIV&gt;&lt;DIV&gt;for (var i = 0; i &amp;lt; dbaseHeader.NumRecords; i++)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; reader.Read();&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string id = reader.GetString(1);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NetTopologySuite.Geometries.Geometry geometry = reader.Geometry;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NetTopologySuite.Geometries.Coordinate coordinate = new NetTopologySuite.Geometries.Coordinate();&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NetTopologySuite.IO.WKTWriter wktWrirer = new NetTopologySuite.IO.WKTWriter();&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; coordinate = geometry.Coordinate;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine("Id " + i + ": " + id);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine("X Mercator " + i + ": " + coordinate.X);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine("Y Mercator " + i + ": " + coordinate.Y);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; double[] coordinateMercator = new double[] { coordinate.X, coordinate.Y };&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; double[] coordinateWGS84 = tr.MathTransform.Transform(coordinateMercator);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine("X WGS84 " + i + ": " + coordinateWGS84[0]);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine("Y WGS84 " + i + ": " + coordinateWGS84[1]);&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;</description>
      <pubDate>Wed, 09 Dec 2020 16:13:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/netopology-wkt-for-coordinates/m-p/1008093#M5704</guid>
      <dc:creator>AndréGrce</dc:creator>
      <dc:date>2020-12-09T16:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: Netopology wkt for coordinates</title>
      <link>https://community.esri.com/t5/developers-questions/netopology-wkt-for-coordinates/m-p/1008133#M5705</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/219831"&gt;@AndréGrce&lt;/a&gt;,&amp;nbsp; same question as &lt;A href="https://community.esri.com/t5/developers-questions/get-wkt-string-for-a-given-shapefile/m-p/1008050#M5703" target="_blank"&gt;Get wkt string for a given shapefile - GeoNet, The Esri Community?&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 17:22:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/netopology-wkt-for-coordinates/m-p/1008133#M5705</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-12-09T17:22:44Z</dc:date>
    </item>
    <item>
      <title>Re: Netopology wkt for coordinates</title>
      <link>https://community.esri.com/t5/developers-questions/netopology-wkt-for-coordinates/m-p/1008135#M5706</link>
      <description>&lt;P&gt;Given you are on an Esri online community, I will assume you have access to ArcGIS Desktop software.&amp;nbsp; You can use ArcPy to extract WKT from shapes in a shape file.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

shp_file = # path to shape file

with arcpy.da.SearchCursor(shp_file, "SHAPE@WKT") as cur:
    for row in cur:
        print(row[0])&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 09 Dec 2020 17:28:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/netopology-wkt-for-coordinates/m-p/1008135#M5706</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-12-09T17:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Netopology wkt for coordinates</title>
      <link>https://community.esri.com/t5/developers-questions/netopology-wkt-for-coordinates/m-p/1008384#M5707</link>
      <description>&lt;P&gt;Thank you Joshua,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can get wkt strings for shape geometries, but I need wkt for the coordinate system used. Otherwise I can not transform the x/y to lat/long coodinates. Preferrably a function from a C# class library.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 07:45:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/netopology-wkt-for-coordinates/m-p/1008384#M5707</guid>
      <dc:creator>AndréGrce</dc:creator>
      <dc:date>2020-12-10T07:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: Netopology wkt for coordinates</title>
      <link>https://community.esri.com/t5/developers-questions/netopology-wkt-for-coordinates/m-p/1008599#M5708</link>
      <description>&lt;P&gt;There are a couple different ways to get the WKID of the shapes.&amp;nbsp; One way is through the spatialReference object of the dataset:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
&amp;gt;&amp;gt;&amp;gt;
shp_file = # path to shape file
arcpy.Describe(shp_file).spatialReference.factoryCode&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 10 Dec 2020 18:15:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/netopology-wkt-for-coordinates/m-p/1008599#M5708</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-12-10T18:15:17Z</dc:date>
    </item>
  </channel>
</rss>

