<?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 set graphic on a location(lat-lon) in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/set-graphic-on-a-location-lat-lon/m-p/642533#M4411</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Good day all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am a bit NOOB here....so sorry for the basic question here...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I took the HelloWorld sample and now i want to add a Red circle on a location using lat-lon, for example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;double locx = 32.062910;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;double locy = 34.780891;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SimpleMarkerSymbol symbol new SimpleMarkerSymbol(Color.RED,25, SimpleMarkerSymbol.STYLE.CIRCLE)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i've added a GraphicsLayer to my MapView&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and now i'm stuck...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If i try to add a new Graphic to my GraphicsLayer using my lat-lon the marker apears in the middle of the map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I use : &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;new Graphic(new Point(locx, locy), symbol));&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;can someone explain how to set the graphic in the correct place?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;also, in the sample main.xml layout file,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;you set the attribute initExtent. what does it mean?!?!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(initExtent = "-19332033.11, -3516.27, -1720941.80, 11737211.28")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Raz&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Jan 2014 07:59:04 GMT</pubDate>
    <dc:creator>razmaimon</dc:creator>
    <dc:date>2014-01-20T07:59:04Z</dc:date>
    <item>
      <title>set graphic on a location(lat-lon)</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/set-graphic-on-a-location-lat-lon/m-p/642533#M4411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Good day all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am a bit NOOB here....so sorry for the basic question here...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I took the HelloWorld sample and now i want to add a Red circle on a location using lat-lon, for example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;double locx = 32.062910;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;double locy = 34.780891;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SimpleMarkerSymbol symbol new SimpleMarkerSymbol(Color.RED,25, SimpleMarkerSymbol.STYLE.CIRCLE)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i've added a GraphicsLayer to my MapView&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and now i'm stuck...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If i try to add a new Graphic to my GraphicsLayer using my lat-lon the marker apears in the middle of the map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I use : &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;new Graphic(new Point(locx, locy), symbol));&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;can someone explain how to set the graphic in the correct place?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;also, in the sample main.xml layout file,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;you set the attribute initExtent. what does it mean?!?!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(initExtent = "-19332033.11, -3516.27, -1720941.80, 11737211.28")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Raz&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2014 07:59:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/set-graphic-on-a-location-lat-lon/m-p/642533#M4411</guid>
      <dc:creator>razmaimon</dc:creator>
      <dc:date>2014-01-20T07:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: set graphic on a location(lat-lon)</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/set-graphic-on-a-location-lat-lon/m-p/642534#M4412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Raz - all questions are welcome, experts or beginners!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The simple answer is you need to change your latitude,longitude coordinates to the same system that is used in the map, then your point should show up where you expect it to be. Try changing the line that adds the graphic to this, where the points are projected, and then used in the graphic:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Point pt = GeometryEngine.project(locx,&amp;nbsp; locy,&amp;nbsp; mMapView.getSpatialReference());
Graphic g = new Graphic(pt, symbol); &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Some more background on this - when you create a map, the spatial reference is automatically set, and matches the spatial reference of the first layer that you added. A spatial reference defines what system of coordinates are used for that map - there are thousands of systems, but typically most people only have to think about one or two.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the Hello World sample, the MapView has the 'Topo' basemap set in the layout, main.xml. All of Esri's basemaps use a system called&amp;nbsp; Web Mercator Auxilliary Sphere which does not use latitude,longitude, it uses a grid of meters. So your lat,long coordinates dont match with the basemap in the place you'd expect. You can use the Project method on the GeometryEngine class to change between the common systems:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/en/android/api-reference/reference/com/esri/core/geometry/GeometryEngine.html#project(double,%20double,%20com.esri.core.geometry.SpatialReference)" rel="nofollow noopener noreferrer" target="_blank"&gt;https://developers.arcgis.com/en/android/api-reference/reference/com/esri/core/geometry/GeometryEngine.html#project(double,%20double,%20com.esri.core.geometry.SpatialReference)&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the code above, the project method is assuming you have latitude,longitude coordinates using the WGS 84 coordinate system, which is one of the most common. It depends where you got the coordinates from as to what system they might use, but there's a fairly good chance this is suitable. The second parameters indicates that you want to project to the system used by the MapView. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;you set the attribute initExtent. what does it mean?!?!&lt;BR /&gt;(initExtent = "-19332033.11, -3516.27, -1720941.80, 11737211.28")&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; So this is just some coordinates of xmin,ymin etc but using the web mercator auxiliary sphere system, not latitude and longitude.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:18:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/set-graphic-on-a-location-lat-lon/m-p/642534#M4412</guid>
      <dc:creator>ShellyGill1</dc:creator>
      <dc:date>2021-12-12T03:18:14Z</dc:date>
    </item>
  </channel>
</rss>

