<?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 Reading .dbf data from a Shapefile in Java Maps SDK Questions</title>
    <link>https://community.esri.com/t5/java-maps-sdk-questions/reading-dbf-data-from-a-shapefile/m-p/1005400#M2273</link>
    <description>&lt;P&gt;I apologize in advance of this is a basic question.&lt;BR /&gt;&lt;BR /&gt;I am trying to access the data attached to a shapefile (.dbf data). I am able to read and display the map using a ShapefileFeatureTable.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I want to be able to read the .dbf data. The shapefile am using is LondonBorroughs.shp (&lt;A href="https://github.com/Robinlovelace/Creating-maps-in-R/tree/master/data" target="_blank"&gt;https://github.com/Robinlovelace/Creating-maps-in-R/tree/master/data&lt;/A&gt;). It contains info such as "name" and "Pop_2001" (the population in 2001).&lt;BR /&gt;&lt;BR /&gt;I want to - for instance - click on a map feature and extract the name and population for that specific feature.&lt;BR /&gt;&lt;BR /&gt;Any assistance would be highly appreciated.&lt;/P&gt;</description>
    <pubDate>Sun, 29 Nov 2020 18:41:50 GMT</pubDate>
    <dc:creator>MarylynAlaso</dc:creator>
    <dc:date>2020-11-29T18:41:50Z</dc:date>
    <item>
      <title>Reading .dbf data from a Shapefile</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/reading-dbf-data-from-a-shapefile/m-p/1005400#M2273</link>
      <description>&lt;P&gt;I apologize in advance of this is a basic question.&lt;BR /&gt;&lt;BR /&gt;I am trying to access the data attached to a shapefile (.dbf data). I am able to read and display the map using a ShapefileFeatureTable.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I want to be able to read the .dbf data. The shapefile am using is LondonBorroughs.shp (&lt;A href="https://github.com/Robinlovelace/Creating-maps-in-R/tree/master/data" target="_blank"&gt;https://github.com/Robinlovelace/Creating-maps-in-R/tree/master/data&lt;/A&gt;). It contains info such as "name" and "Pop_2001" (the population in 2001).&lt;BR /&gt;&lt;BR /&gt;I want to - for instance - click on a map feature and extract the name and population for that specific feature.&lt;BR /&gt;&lt;BR /&gt;Any assistance would be highly appreciated.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Nov 2020 18:41:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/reading-dbf-data-from-a-shapefile/m-p/1005400#M2273</guid>
      <dc:creator>MarylynAlaso</dc:creator>
      <dc:date>2020-11-29T18:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: Reading .dbf data from a Shapefile</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/reading-dbf-data-from-a-shapefile/m-p/1005411#M2274</link>
      <description>&lt;P&gt;Why not add the shapefile to an empty map so you have a layer in the map's table of contents.&lt;/P&gt;&lt;P&gt;Right-click on the layer and open its attribute table&lt;/P&gt;</description>
      <pubDate>Sun, 29 Nov 2020 21:41:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/reading-dbf-data-from-a-shapefile/m-p/1005411#M2274</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-11-29T21:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: Reading .dbf data from a Shapefile</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/reading-dbf-data-from-a-shapefile/m-p/1005415#M2275</link>
      <description>&lt;P&gt;You can read .dbf files with programs such as MS Excel. You should not attempt to edit the file outside of ArcGIS Desktop/ArcGIS Pro however because it can corrupt the data.&lt;/P&gt;&lt;P&gt;The supported method of viewing DBF data is in ArcGIS Desktop/ArcGIS Pro by loading the Shapefile into your map and then Right clicking on the layer in your Table of Contents and then opening the Attribute Table.&lt;/P&gt;&lt;P&gt;To open the DBF file in MS Excel, Go to Open &amp;gt; Navigate to where the DBF file is then select open.&lt;/P&gt;&lt;P&gt;You will need to make sure the&lt;STRONG&gt; All Files&lt;/STRONG&gt; or &lt;STRONG&gt;DBF Files&lt;/STRONG&gt; file filter is on however.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2020-11-30_9-04-56.png" style="width: 955px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/1159iD18F444E5D06B071/image-size/large?v=v2&amp;amp;px=999" role="button" title="2020-11-30_9-04-56.png" alt="2020-11-30_9-04-56.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Nov 2020 22:14:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/reading-dbf-data-from-a-shapefile/m-p/1005415#M2275</guid>
      <dc:creator>BenCoubrough</dc:creator>
      <dc:date>2020-11-29T22:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: Reading .dbf data from a Shapefile</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/reading-dbf-data-from-a-shapefile/m-p/1005442#M2276</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/423920"&gt;@MarylynAlaso&lt;/a&gt;&amp;nbsp;I can see you have posted this question in the ArcGIS Runtime for Java area so I'm assuming you are writing a JavaFX application.&lt;/P&gt;&lt;P&gt;When you are working with any types of features regardless on if it comes from OGC data, feature layers, or in your case shapefiles, you can perform a programatic "identify" operation.&amp;nbsp; This basically allows you to get geometry and attribute information from the item you have just clicked on.&lt;/P&gt;&lt;P&gt;I've not used your specific data, but I've built upon an existing samples we have in git:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Esri/arcgis-runtime-samples-java/tree/master/feature_layers/feature-layer-shapefile" target="_blank" rel="noopener"&gt;https://github.com/Esri/arcgis-runtime-samples-java/tree/master/feature_layers/feature-layer-shapefile&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I've added some extra code to listen into mouse click events and use that point to perform an identify operation.&amp;nbsp; In its current form, the code just outputs text to the console, but it should help you to develop the next stage of your application.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;// add the feature layer to the map&lt;BR /&gt;&lt;/SPAN&gt;map.getOperationalLayers().add(&lt;SPAN&gt;featureLayer&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;// listen into clicks and identify results&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;mapView&lt;/SPAN&gt;.setOnMouseClicked(event -&amp;gt; {&lt;BR /&gt;  System.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;"clicked"&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;  Point2D clickedPoint = &lt;SPAN&gt;new &lt;/SPAN&gt;Point2D(event.getX()&lt;SPAN&gt;, &lt;/SPAN&gt;event.getY())&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;  // listenable future for waiting for results from identify on layer&lt;BR /&gt;&lt;/SPAN&gt;  ListenableFuture&amp;lt;IdentifyLayerResult&amp;gt; resultFuture = &lt;SPAN&gt;mapView&lt;/SPAN&gt;.identifyLayerAsync(&lt;SPAN&gt;featureLayer&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;clickedPoint&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;10&lt;/SPAN&gt;&lt;SPAN&gt;,false&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;  resultFuture.addDoneListener(() -&amp;gt; {&lt;BR /&gt;    System.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;"got result"&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    try &lt;/SPAN&gt;{&lt;BR /&gt;      // get the results from the future&lt;BR /&gt;      IdentifyLayerResult result = &lt;SPAN&gt;resultFuture&lt;/SPAN&gt;.get()&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;      // loop through each element (probably only 1) and get the attributes&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;      for &lt;/SPAN&gt;(GeoElement element : result.getElements()) {&lt;BR /&gt;        Map&amp;lt;String&lt;SPAN&gt;, &lt;/SPAN&gt;Object&amp;gt; attributes = element.getAttributes()&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;        System.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;"attributes " &lt;/SPAN&gt;+ attributes)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;      }&lt;BR /&gt;&lt;BR /&gt;    } &lt;SPAN&gt;catch &lt;/SPAN&gt;(InterruptedException e) {&lt;BR /&gt;      e.printStackTrace()&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;    } &lt;SPAN&gt;catch &lt;/SPAN&gt;(ExecutionException e) {&lt;BR /&gt;      e.printStackTrace()&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;    }&lt;BR /&gt;  })&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;})&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Does this help?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 09:02:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/reading-dbf-data-from-a-shapefile/m-p/1005442#M2276</guid>
      <dc:creator>MarkBaird</dc:creator>
      <dc:date>2020-11-30T09:02:40Z</dc:date>
    </item>
  </channel>
</rss>

