Hi
I try search many tutorial on how can convert the map coordinate(Lat/Long) to screen coordinate but it seem i can't find any of it. I want to perform a traverse method for the map to plot a marker. Any suggestion and idea are much appreciate.
Hi Nicholas Furness
It work. Thank for your help.
I meant that you should call mapView.LocationToScreen, not write your own function.
Something like…
<SPAN class="keyword token">double</SPAN> longitude <SPAN class="operator token">=</SPAN> <SPAN class="number token">100.458802</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">//reference starting point</SPAN> <SPAN class="keyword token">double</SPAN> latitude <SPAN class="operator token">=</SPAN> <SPAN class="number token">5.997545</SPAN><SPAN class="punctuation token">;</SPAN> location <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">MapPoint</SPAN><SPAN class="punctuation token">(</SPAN>longitude<SPAN class="punctuation token">,</SPAN>latitude<SPAN class="punctuation token">,</SPAN> SpatialReferences<SPAN class="punctuation token">.</SPAN>Wgs84<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> screenPoint <SPAN class="operator token">=</SPAN> mapView<SPAN class="punctuation token">.</SPAN><SPAN class="token function">LocationToScreen</SPAN><SPAN class="punctuation token">(</SPAN>location<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Perhaps I misunderstood your question.
I try the reference you share.
double longitude = 100.458802; //reference starting point double latitude = 5.997545;public Point LocationToScreen(MapPoint location) { location = new MapPoint(longitude,latitude, SpatialReferences.Wgs84); return location; }
double longitude = 100.458802; //reference starting point double latitude = 5.997545;
public Point LocationToScreen(MapPoint location) { location = new MapPoint(longitude,latitude, SpatialReferences.Wgs84); return location; }
But it get me this error :
Cannot implicitly convert type 'Esri.ArcGISRuntime.Geometry.MapPoint' to 'System.Windows.Point'
Fathin
Hi Mohamad Fathin,
Does this help? MapView.LocationToScreen Method
Pass in any MapPoint and you get a screen position relative to the top-left corner of the MapView control.
Nick.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.