<?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: Comparing spatial references in Java Maps SDK Questions</title>
    <link>https://community.esri.com/t5/java-maps-sdk-questions/comparing-spatial-references/m-p/423582#M1315</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you checked that the shapefile has a spatial reference assigned to it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A shapefile can happily exist without ever being assigned a spatial reference. This would explain why you get null as a result of the getSpatialReference() call.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 May 2015 02:48:48 GMT</pubDate>
    <dc:creator>OwenEarley</dc:creator>
    <dc:date>2015-05-04T02:48:48Z</dc:date>
    <item>
      <title>Comparing spatial references</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/comparing-spatial-references/m-p/423581#M1314</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My app allows a user to choose a shapefile from their computer to load on top of a pre-selected basemap - currently just an ArcGIS Online map service added as a ArcGISDynamicMapServiceLayer.&amp;nbsp; I'm using a FeatureLayer to store the shapefile.&amp;nbsp; What is the best way to determine if the shapefile is of the same spatial reference as the basemap? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My goal is to send a message to the user when their shapefile projection doesn't match the basemap's projection to let them know that the layer will not be added to the map.&amp;nbsp; I can't seem to retrieve the shapefile's spatial reference though when using the "getSpatialReference()" method, even after adding the FeatureLayer to the map.&amp;nbsp; I have tried this with a shapefile that matches the basemap projection, and with a shapefile that doesn't match the basemap projection...the value of the FeatureLayer spatial reference is always null. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;map.getLayers().add(&lt;/SPAN&gt;&lt;SPAN style="color: #0000c0; font-size: 10pt;"&gt;featureLayer&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #0000c0; font-size: 10pt;"&gt;System.out&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;.println(&lt;/SPAN&gt;&lt;SPAN style="color: #2a00ff; font-size: 10pt;"&gt;"Map projection is now: "&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; + &lt;/SPAN&gt;&lt;SPAN style="color: #6a3e3e; font-size: 10pt;"&gt;map&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;.getSpatialReference());&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #0000c0; font-size: 10pt;"&gt;System.&lt;/EM&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #0000c0; font-size: 10pt;"&gt;out&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;.println(&lt;/SPAN&gt;&lt;SPAN style="color: #2a00ff; font-size: 10pt;"&gt;"Layer projection is now: "&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; + &lt;/SPAN&gt;&lt;SPAN style="color: #0000c0; font-size: 10pt;"&gt;featureLayer&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;.getSpatialReference());&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #0000c0; font-size: 10pt;"&gt;System.&lt;/EM&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #0000c0; font-size: 10pt;"&gt;out&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;.println(&lt;/SPAN&gt;&lt;SPAN style="color: #2a00ff; font-size: 10pt;"&gt;"Basemap projection is now: "&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; + &lt;/SPAN&gt;&lt;SPAN style="color: #6a3e3e; font-size: 10pt;"&gt;basemap&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;.getSpatialReference()); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;...just prints this output:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Map projection is now: SpatialReference [mWKID=102100, mWKT=PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere"...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Layer projection is now: null&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basemap projection is now: SpatialReference [mWKID=102100, mWKT=PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere"...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm just starting to learn the Java API so any help would be appreciated.&amp;nbsp; I haven't found any good examples yet of how to deal with this situation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 May 2015 02:40:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/comparing-spatial-references/m-p/423581#M1314</guid>
      <dc:creator>DaniMaynard</dc:creator>
      <dc:date>2015-05-04T02:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing spatial references</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/comparing-spatial-references/m-p/423582#M1315</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you checked that the shapefile has a spatial reference assigned to it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A shapefile can happily exist without ever being assigned a spatial reference. This would explain why you get null as a result of the getSpatialReference() call.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 May 2015 02:48:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/comparing-spatial-references/m-p/423582#M1315</guid>
      <dc:creator>OwenEarley</dc:creator>
      <dc:date>2015-05-04T02:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing spatial references</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/comparing-spatial-references/m-p/423583#M1316</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My two test shapefiles both have .prj files associated with them.&amp;nbsp; One is simply geographic - GCS_WGS_1984 - and the other is WGS_1984_Web_Mercator_Auxiliary_Sphere (which matches the projection of my basemap). &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 May 2015 02:57:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/comparing-spatial-references/m-p/423583#M1316</guid>
      <dc:creator>DaniMaynard</dc:creator>
      <dc:date>2015-05-04T02:57:32Z</dc:date>
    </item>
  </channel>
</rss>

