1

I have looked at many libraries. Many simply don't work, others are very poorly documented.

I have a very long list of X/Y coordinates (US FT) and an associated WKID. I am trying to convert that to Lat/Lon format for mapping.

Can anyone suggest routes for completing this process in vb.net?

(the closest I've come to success is finding the esri.arcgisruntime.geometry.ProjectionConverter.convert - This seems to give me the option to suggest a wkid, x & y coord... but It's poorly documented and, unfortunately, I can't get it to do any conversions)

    Dim wkid as integer= 102100
    Dim ref As New Esri.ArcGISRuntime.Geometry.SpatialReference(wkid)
    Dim converter = New Esri.ArcGISRuntime.Geometry.ProjectionConverter()
    Dim mappoint = New Esri.ArcGISRuntime.Geometry.MapPoint(-9638404.7886215933, 3990218.2857465576, ref)
    Dim typ As Type = GetType(Esri.ArcGISRuntime.Geometry.MapPoint)
    Dim glob As New Globalization.CultureInfo("en")
    Dim result = converter.Convert(mappoint, typ, wkid, glob)

FYI, if there are some arcgis account auth required, I do not have that.

7
  • 1
    Precisely what did you try to do with ArcGIS Runtime, and precisely where are you stuck? This is a great opportunity to show your skills at documenting a problem that you have encountered.
    – PolyGeo
    Dec 12, 2015 at 3:29
  • sorry, was quite a long day. I added the code i used with arc runtime library.
    – stevo22
    Dec 12, 2015 at 13:24
  • You left out the definition and content of wkid
    – Vince
    Dec 12, 2015 at 15:27
  • I'm passing wkid to the code, it's an integer.
    – stevo22
    Dec 12, 2015 at 16:50
  • Try setting the spatial reference as well when creating the MapPoint, then the wkid in the converter will be the output wkid like EPSG:4269 (NAD 1983). The help says "The input geometry must have a spatial reference defined."
    – mkennedy
    Dec 13, 2015 at 1:48

1 Answer 1

0

For those interested I've managed to get this working, I'm converting from MGA meters to a local map grid projection, also in meters.

private Esri.ArcGISRuntime.Geometry.MapPoint ConvertToLocalMapGridCoords(Esri.ArcGISRuntime.Geometry.MapPoint sourceMapPoint, string projectionFile)
{
    var wkTextDest = System.IO.File.ReadAllText(projectionFile);

    var projectionConverter = new Esri.ArcGISRuntime.Geometry.ProjectionConverter();
    var result = projectionConverter.Convert(sourceMapPoint, typeof(MapPoint), wkTextDest, System.Globalization.CultureInfo.InvariantCulture);

    return (Esri.ArcGISRuntime.Geometry.MapPoint)result;
}

I'm calling it using: (You will most likely be doing something completely different here!)

const int wkidSource = 102100;
var coordPoint = newMapControl.ScreenPointToCoordPoint(e.Location);

var mouseMapPoint = Esri.ArcGISRuntime.Geometry.ConvertCoordinate.FromDecimalDegrees(string.Format("{0},{1}", coordPoint.GetY(), coordPoint.GetX()), new Esri.ArcGISRuntime.Geometry.SpatialReference(wkidSource));

var convertedMapPoint = ConvertToLocalMapGridCoords(mouseMapPoint, @"C:\abc\xyz.prj");

I'm creating a spacial reference from a well known text (ESRI Projection File .prj).

Note: coordPoint.GetY(), coordPoint.GetX() are just Decimal latitudes and longitudes respectively.

1
  • Thanks Kris, I'm a bit late on this because I ended up scrapping the method and going a different route. Glad you were able to get this working. I can't test, but Since you're the only answer I'll give you that. Thanks for posting this for future endeavors. :)
    – stevo22
    Jul 19, 2016 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.