public FeatureLayer getLayerByName(String layerName, com.esri.arcgis.carto.Map map) { FeatureLayer layer = null; try { for (int i = 0; i < map.getLayerCount(); i++) { if (map.getLayer(i).getName().equalsIgnoreCase(layerName)) { layer = (FeatureLayer) map.getLayer(i); break; } } } catch (AutomationException ae) { ae.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return layer; }
Checking some of my desktop apps, when I use the Append geoprocessing tool, I use FeatureLayer objects as inputs and targets.
ShapefileWorkspaceFactory wsf = new ShapefileWorkspaceFactory(); Workspace work = new Workspace(wsf.openFromFile(location, 0)); IFeatureClass featureClass = work.openFeatureClass("NameOfYourShapefile");
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.