<?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: Load and display local shapefile on a disconnected system in ArcGIS Maps SDKs Native Videos</title>
    <link>https://community.esri.com/t5/arcgis-maps-sdks-native-videos/load-and-display-local-shapefile-on-a-disconnected/m-p/1033951#M8</link>
    <description>&lt;P&gt;Yes it is possible, in Qt/c++ at least.&amp;nbsp; You can call "featureLayer.load();" right before you add the feature layer to the operationalLayers.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Mar 2021 15:02:35 GMT</pubDate>
    <dc:creator>TroyFoster</dc:creator>
    <dc:date>2021-03-08T15:02:35Z</dc:date>
    <item>
      <title>Load and display local shapefile on a disconnected system</title>
      <link>https://community.esri.com/t5/arcgis-maps-sdks-native-videos/load-and-display-local-shapefile-on-a-disconnected/m-p/1033890#M7</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am building an offline (permanently disconnected system) application. I need to load a combination of raster and shapefiles as different layers. Is there a sample program available to demonstrate this in 100.9 or above.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it also possible to load and display it without the base map?&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;&lt;P&gt;Giridhar&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TileCache tileCache = new TileCache("\local_server\mpk_blank.mpk");&lt;BR /&gt;ArcGISTiledLayer tiledLayer = new ArcGISTiledLayer(tileCache);&lt;BR /&gt;Basemap basemap = new Basemap(tiledLayer);&lt;BR /&gt;// ArcGISMap map = new ArcGISMap(Basemap.createStreetsVector());&lt;BR /&gt;ArcGISMap map = new ArcGISMap(basemap);&lt;BR /&gt;&lt;BR /&gt;mapView = new MapView();&lt;BR /&gt;mapView.setMap(map);&lt;BR /&gt;&lt;BR /&gt;// create a shapefile feature table from the local file&lt;BR /&gt;File shapefile = new File(System.getProperty("data.dir"), "\san_diego_boundary_datasd.shp");&lt;BR /&gt;ShapefileFeatureTable shapefileFeatureTable = new ShapefileFeatureTable(shapefile.getAbsolutePath());&lt;BR /&gt;// use the shapefile feature table to create a feature layer&lt;BR /&gt;featureLayer = new FeatureLayer(shapefileFeatureTable);&lt;BR /&gt;featureLayer.addDoneLoadingListener(() -&amp;gt; {&lt;BR /&gt;if (featureLayer.getLoadStatus() == LoadStatus.LOADED) {&lt;BR /&gt;Alert alert = new Alert(Alert.AlertType.INFORMATION, "loaded success...");&lt;BR /&gt;alert.show();&lt;BR /&gt;} else {&lt;BR /&gt;Alert alert = new Alert(Alert.AlertType.ERROR, featureLayer.getLoadError().getMessage());&lt;BR /&gt;alert.show();&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;// add the feature layer to the map&lt;BR /&gt;map.getOperationalLayers().add(featureLayer);&lt;BR /&gt;//add the map view to the stack pane&lt;BR /&gt;stackPane.getChildren().add(mapView);&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 12:50:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-maps-sdks-native-videos/load-and-display-local-shapefile-on-a-disconnected/m-p/1033890#M7</guid>
      <dc:creator>GiridharPragada</dc:creator>
      <dc:date>2021-03-08T12:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: Load and display local shapefile on a disconnected system</title>
      <link>https://community.esri.com/t5/arcgis-maps-sdks-native-videos/load-and-display-local-shapefile-on-a-disconnected/m-p/1033951#M8</link>
      <description>&lt;P&gt;Yes it is possible, in Qt/c++ at least.&amp;nbsp; You can call "featureLayer.load();" right before you add the feature layer to the operationalLayers.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 15:02:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-maps-sdks-native-videos/load-and-display-local-shapefile-on-a-disconnected/m-p/1033951#M8</guid>
      <dc:creator>TroyFoster</dc:creator>
      <dc:date>2021-03-08T15:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: Load and display local shapefile on a disconnected system</title>
      <link>https://community.esri.com/t5/arcgis-maps-sdks-native-videos/load-and-display-local-shapefile-on-a-disconnected/m-p/1034333#M9</link>
      <description>&lt;P&gt;Thanks for the reply.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I still don't see anything on the map in disconnected mode. Any suggestion on what could be wrong here?&lt;/P&gt;&lt;P&gt;//////////////////////////////////////////////////////////////////////////&lt;/P&gt;&lt;P&gt;public class LocalServerMapImageLayerSample extends Application {&lt;/P&gt;&lt;P&gt;private static final int APPLICATION_WIDTH = 800;&lt;/P&gt;&lt;P&gt;private ArcGISMapImageLayer imageLayer; // keep loadable in scope to avoid garbage collection&lt;BR /&gt;private MapView mapView;&lt;BR /&gt;private LocalMapService mapImageService;&lt;BR /&gt;private ProgressIndicator imageLayerProgress;&lt;/P&gt;&lt;P&gt;@Override&lt;BR /&gt;public void start(Stage stage) {&lt;/P&gt;&lt;P&gt;try {&lt;BR /&gt;// create stack pane and application scene&lt;BR /&gt;StackPane stackPane = new StackPane();&lt;BR /&gt;Scene scene = new Scene(stackPane);&lt;/P&gt;&lt;P&gt;// set title, size, and add scene to stage&lt;BR /&gt;stage.setTitle("Local Server Map Image Layer Sample");&lt;BR /&gt;stage.setWidth(APPLICATION_WIDTH);&lt;BR /&gt;stage.setHeight(700);&lt;BR /&gt;stage.setScene(scene);&lt;BR /&gt;stage.show();&lt;/P&gt;&lt;P&gt;// create a view with a map and basemap&lt;BR /&gt;ArcGISMap map = new ArcGISMap(Basemap.createStreets());&lt;BR /&gt;mapView = new MapView();&lt;BR /&gt;mapView.setMap(map);&lt;/P&gt;&lt;P&gt;// track progress of loading map image layer to map&lt;BR /&gt;imageLayerProgress = new ProgressIndicator(ProgressIndicator.INDETERMINATE_PROGRESS);&lt;BR /&gt;imageLayerProgress.setMaxWidth(30);&lt;/P&gt;&lt;P&gt;// check that local server install path can be accessed&lt;BR /&gt;if (LocalServer.INSTANCE.checkInstallValid()) {&lt;BR /&gt;LocalServer server = LocalServer.INSTANCE;&lt;BR /&gt;// start local server&lt;BR /&gt;server.addStatusChangedListener(status -&amp;gt; {&lt;BR /&gt;if (status.getNewStatus() == LocalServerStatus.STARTED) {&lt;BR /&gt;// start map image service&lt;BR /&gt;String mapServiceURL = new File(System.getProperty("data.dir"), "C:\\GISData\\data\\mpks\\PointsofInterest.mpk").getAbsolutePath();&lt;BR /&gt;mapImageService = new LocalMapService(mapServiceURL);&lt;BR /&gt;mapImageService.addStatusChangedListener(this::addLocalMapImageLayer);&lt;BR /&gt;mapImageService.startAsync();&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;server.startAsync();&lt;BR /&gt;} else {&lt;BR /&gt;Platform.runLater(() -&amp;gt; {&lt;BR /&gt;Alert dialog = new Alert(AlertType.INFORMATION);&lt;BR /&gt;dialog.initOwner(mapView.getScene().getWindow());&lt;BR /&gt;dialog.setHeaderText("Local Server Load Error");&lt;BR /&gt;dialog.setContentText("Local Geoprocessing Failed to load.");&lt;BR /&gt;dialog.show();&lt;BR /&gt;});&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// add view to application window with progress bar&lt;BR /&gt;stackPane.getChildren().addAll(mapView, imageLayerProgress);&lt;BR /&gt;StackPane.setAlignment(imageLayerProgress, Pos.CENTER);&lt;BR /&gt;} catch (Exception e) {&lt;BR /&gt;// on any error, display the stack trace.&lt;BR /&gt;e.printStackTrace();&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt;* Once the map service starts, a map image layer is created from that service and added to the map.&lt;BR /&gt;* &amp;lt;p&amp;gt;&lt;BR /&gt;* When the map image layer is done loading, the view will zoom to the location of were the image has been added.&lt;BR /&gt;*&lt;BR /&gt;* @param status status of feature service&lt;BR /&gt;*/&lt;BR /&gt;private void addLocalMapImageLayer(StatusChangedEvent status) {&lt;/P&gt;&lt;P&gt;// check that the map service has started&lt;BR /&gt;if (status.getNewStatus() == LocalServerStatus.STARTED &amp;amp;&amp;amp; mapView.getMap() != null) {&lt;BR /&gt;// get the url of where map service is located&lt;BR /&gt;String url = mapImageService.getUrl();&lt;BR /&gt;// create a map image layer using url&lt;BR /&gt;imageLayer = new ArcGISMapImageLayer(url);&lt;BR /&gt;// set viewpoint once layer has loaded&lt;BR /&gt;imageLayer.addDoneLoadingListener(() -&amp;gt; {&lt;BR /&gt;Envelope extent = imageLayer.getFullExtent();&lt;BR /&gt;if (imageLayer.getLoadStatus() == LoadStatus.LOADED &amp;amp;&amp;amp; extent != null) {&lt;BR /&gt;mapView.setViewpoint(new Viewpoint(extent));&lt;BR /&gt;Platform.runLater(() -&amp;gt; imageLayerProgress.setVisible(false));&lt;BR /&gt;} else {&lt;BR /&gt;Alert alert = new Alert(Alert.AlertType.ERROR, "Image Layer Failed to Load!");&lt;BR /&gt;alert.show();&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;imageLayer.loadAsync();&lt;BR /&gt;// add image layer to map&lt;BR /&gt;mapView.getMap().getOperationalLayers().add(imageLayer);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 06:05:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-maps-sdks-native-videos/load-and-display-local-shapefile-on-a-disconnected/m-p/1034333#M9</guid>
      <dc:creator>GiridharPragada</dc:creator>
      <dc:date>2021-03-09T06:05:06Z</dc:date>
    </item>
  </channel>
</rss>

