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");
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.