<?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 getGeometryType() not working? in Java Maps SDK Questions</title>
    <link>https://community.esri.com/t5/java-maps-sdk-questions/getgeometrytype-not-working/m-p/548746#M1721</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey all&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a bunch of ArcGISFeatureLayer objects which originate from a map package.&amp;nbsp; I'd like to be able to query the geometry type and set different opacity levels depending on the geometry type.&amp;nbsp; Below is a very simple example of the type of thing I am trying to do.&amp;nbsp; Unfortunately it seems that the method getGeometryType() always returns a null value.&amp;nbsp; Yes I've tried with different map packages and different layers, but it seems like the getGeometryType() always comes back as null.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there another way to find out what kind of geometry the feature class that sits behind the ArcGISLocalFeatureLayer object has.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;package testing;&amp;nbsp; import com.esri.client.local.ArcGISLocalFeatureLayer; import com.esri.core.geometry.Geometry.Type;&amp;nbsp; public class getGeomTypes {&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String[] args) { &amp;nbsp; String mapPackage = "C:\\eclipse_config\\3.7.2\\ITN_EditMap\\data\\set1\\mapPackge_referencesdata_includesSDE.mpk"; &amp;nbsp; ArcGISLocalFeatureLayer flObj = new ArcGISLocalFeatureLayer( mapPackage, "roads_gdbc"); &amp;nbsp; Type geomType = flObj.getGeometryType(); &amp;nbsp; if (geomType == Type.Polygon || geomType == Type.Envelope) { &amp;nbsp;&amp;nbsp; flObj.setOpacity(3f); &amp;nbsp; } else { &amp;nbsp;&amp;nbsp; flObj.setOpacity(8f); &amp;nbsp; }&amp;nbsp; }&amp;nbsp; }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kevin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 May 2012 17:07:32 GMT</pubDate>
    <dc:creator>KevinNetherton</dc:creator>
    <dc:date>2012-05-16T17:07:32Z</dc:date>
    <item>
      <title>getGeometryType() not working?</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/getgeometrytype-not-working/m-p/548746#M1721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey all&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a bunch of ArcGISFeatureLayer objects which originate from a map package.&amp;nbsp; I'd like to be able to query the geometry type and set different opacity levels depending on the geometry type.&amp;nbsp; Below is a very simple example of the type of thing I am trying to do.&amp;nbsp; Unfortunately it seems that the method getGeometryType() always returns a null value.&amp;nbsp; Yes I've tried with different map packages and different layers, but it seems like the getGeometryType() always comes back as null.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there another way to find out what kind of geometry the feature class that sits behind the ArcGISLocalFeatureLayer object has.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;package testing;&amp;nbsp; import com.esri.client.local.ArcGISLocalFeatureLayer; import com.esri.core.geometry.Geometry.Type;&amp;nbsp; public class getGeomTypes {&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String[] args) { &amp;nbsp; String mapPackage = "C:\\eclipse_config\\3.7.2\\ITN_EditMap\\data\\set1\\mapPackge_referencesdata_includesSDE.mpk"; &amp;nbsp; ArcGISLocalFeatureLayer flObj = new ArcGISLocalFeatureLayer( mapPackage, "roads_gdbc"); &amp;nbsp; Type geomType = flObj.getGeometryType(); &amp;nbsp; if (geomType == Type.Polygon || geomType == Type.Envelope) { &amp;nbsp;&amp;nbsp; flObj.setOpacity(3f); &amp;nbsp; } else { &amp;nbsp;&amp;nbsp; flObj.setOpacity(8f); &amp;nbsp; }&amp;nbsp; }&amp;nbsp; }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kevin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 17:07:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/getgeometrytype-not-working/m-p/548746#M1721</guid>
      <dc:creator>KevinNetherton</dc:creator>
      <dc:date>2012-05-16T17:07:32Z</dc:date>
    </item>
    <item>
      <title>Re: getGeometryType() not working?</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/getgeometrytype-not-working/m-p/548747#M1722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;As far as I can judge it, you need to initialize (starts the local server and so on) the layer first. Otherwise the layer instance is useless. See code snippet below.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; @Test&amp;nbsp; public void addLocalFeatureLayer() throws InterruptedException { &amp;nbsp; final Lock lock = new ReentrantLock(); &amp;nbsp; lock.lock(); &amp;nbsp; try { &amp;nbsp;&amp;nbsp; final Condition condition = lock.newCondition(); &amp;nbsp;&amp;nbsp; final ArcGISLocalFeatureLayer layer = new ArcGISLocalFeatureLayer(mapPackagePath, "Germany"); &amp;nbsp;&amp;nbsp; layer.addLayerInitializeCompleteListener(new LayerInitializeCompleteListener() { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; @Override &amp;nbsp;&amp;nbsp;&amp;nbsp; public void layerInitializeComplete(LayerInitializeCompleteEvent e) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lock.lock(); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; assertTrue("The local layer must have a valid URL!", null != layer.getUrl()); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type geometryType = layer.getGeometryType(); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; assertTrue("The geometry type is not valid!", Geometry.Type.Polygon == geometryType); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } finally { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; condition.signal(); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lock.unlock(); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp; }); &amp;nbsp;&amp;nbsp; layer.initializeAsync(); &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; condition.await(); &amp;nbsp; } finally { &amp;nbsp;&amp;nbsp; lock.unlock(); &amp;nbsp; }&amp;nbsp; }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2012 11:56:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/getgeometrytype-not-working/m-p/548747#M1722</guid>
      <dc:creator>Jan-Tschada</dc:creator>
      <dc:date>2012-05-25T11:56:05Z</dc:date>
    </item>
  </channel>
</rss>

