<?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 NearestCoordinate throws NotImplementedException in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/nearestcoordinate-throws-notimplementedexception/m-p/189103#M2211</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;GeometryEngine.NearestCoordinate(envelope, mapPoint) throws a NotImplementedException.&lt;/P&gt;&lt;P&gt;This is definitely a bug, as the documentation doesn't mention it: &lt;A class="link-titled" href="https://developers.arcgis.com/net/latest/ios/api-reference/html/M_Esri_ArcGISRuntime_Geometry_GeometryEngine_NearestCoordinate.htm" title="https://developers.arcgis.com/net/latest/ios/api-reference/html/M_Esri_ArcGISRuntime_Geometry_GeometryEngine_NearestCoordinate.htm"&gt;GeometryEngine.NearestCoordinate Method&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The fix is to convert the Envelope to a Polygon:&lt;/P&gt;&lt;P&gt;private static Polygon EnvelopeToPolygon(Envelope envelope)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return new Polygon(new MapPoint[]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new MapPoint(envelope.XMin, envelope.YMin, envelope.SpatialReference),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new MapPoint(envelope.XMax, envelope.YMin, envelope.SpatialReference),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new MapPoint(envelope.XMax, envelope.YMax, envelope.SpatialReference),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new MapPoint(envelope.XMin, envelope.YMax, envelope.SpatialReference)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It really should be implemented, as it's just a few lines of code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 13 Oct 2019 22:58:53 GMT</pubDate>
    <dc:creator>MatthiasPorges</dc:creator>
    <dc:date>2019-10-13T22:58:53Z</dc:date>
    <item>
      <title>NearestCoordinate throws NotImplementedException</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/nearestcoordinate-throws-notimplementedexception/m-p/189103#M2211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;GeometryEngine.NearestCoordinate(envelope, mapPoint) throws a NotImplementedException.&lt;/P&gt;&lt;P&gt;This is definitely a bug, as the documentation doesn't mention it: &lt;A class="link-titled" href="https://developers.arcgis.com/net/latest/ios/api-reference/html/M_Esri_ArcGISRuntime_Geometry_GeometryEngine_NearestCoordinate.htm" title="https://developers.arcgis.com/net/latest/ios/api-reference/html/M_Esri_ArcGISRuntime_Geometry_GeometryEngine_NearestCoordinate.htm"&gt;GeometryEngine.NearestCoordinate Method&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The fix is to convert the Envelope to a Polygon:&lt;/P&gt;&lt;P&gt;private static Polygon EnvelopeToPolygon(Envelope envelope)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return new Polygon(new MapPoint[]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new MapPoint(envelope.XMin, envelope.YMin, envelope.SpatialReference),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new MapPoint(envelope.XMax, envelope.YMin, envelope.SpatialReference),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new MapPoint(envelope.XMax, envelope.YMax, envelope.SpatialReference),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new MapPoint(envelope.XMin, envelope.YMax, envelope.SpatialReference)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It really should be implemented, as it's just a few lines of code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Oct 2019 22:58:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/nearestcoordinate-throws-notimplementedexception/m-p/189103#M2211</guid>
      <dc:creator>MatthiasPorges</dc:creator>
      <dc:date>2019-10-13T22:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: NearestCoordinate throws NotImplementedException</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/nearestcoordinate-throws-notimplementedexception/m-p/189104#M2212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 2.0pt 0in 2.0pt 0in;"&gt;&lt;SPAN style="font-size: 10.0pt; color: black;"&gt;&lt;SPAN style="color: #3d3d3d; background-color: #ffffff;"&gt;GeometryEngine.NearestCoordinate&amp;nbsp;&lt;/SPAN&gt;is not implemented for Envelope. It is as expected &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; color: black;"&gt;because Envelope is not a feature geometry.&amp;nbsp;You are on the right&amp;nbsp;track to get around this limitation by converting envelope to a polygon.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 2.0pt 0in 2.0pt 0in;"&gt;&lt;SPAN style="font-size: 10.0pt; color: black;"&gt;But yes, this should definitely be documented. I have raised an issue to update the documentation to include this information.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2019 18:06:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/nearestcoordinate-throws-notimplementedexception/m-p/189104#M2212</guid>
      <dc:creator>PreetiMaske</dc:creator>
      <dc:date>2019-10-15T18:06:40Z</dc:date>
    </item>
  </channel>
</rss>

