Unable access customize Stylx file by using SymbolStyle API in Java.
SymbolStyle symbolstyle = await SymbolStyle.OpenAsync(String Path); (.Net).
But in java not find the Open Method of SymbolStyle API.
Hi Shiva,
you may use the DictionarySymbolStyle class (DictionarySymbolStyle| arcgis-java) to achieve the same results. In using that class ensure you have the right specification type in the constructor.
I put the below code snippet together for illustration.
private void loadSymbolStyle(String PATH_TO_SYMBOL, String PATH_TO_A_SHAPEFILE) { List<String> keys = new ArrayList<>(); keys.add("key1"); keys.add("key2"); ShapefileFeatureTable shapefile = new ShapefileFeatureTable(PATH_TO_A_SHAPEFILE); FeatureLayer featureLayer = new FeatureLayer(shapefile); featureLayer.loadAsync();
DictionarySymbolStyle dictionarySymStyle = new DictionarySymbolStyle("mil2525d", PATH_TO_SYMBOL); dictionarySymStyle.loadAsync(); dictionarySymStyle.addDoneLoadingListener(() -> { if (dictionarySymStyle.getLoadStatus() == LoadStatus.LOADED) { System.out.println("Loaded!!!"); symbolFuture = dictionarySymStyle.getSymbolAsync(keys); try { Symbol symbol = symbolFuture.get(); featureLayer.setRenderer(new SimpleRenderer(symbol)); mapView.getMap().getOperationalLayers().add(featureLayer); //add loaded layer to map mapView.setViewpointGeometryAsync(featureLayer.getFullExtent(), 100); //zoom to extent
} catch (InterruptedException | ExecutionException inEx) { System.out.println("Get Exception: " + inEx.getMessage()); } } else { System.out.println("Load Error: " + dictionarySymStyle.getLoadError().getAdditionalMessage()); //use this for debugging your code } });
}
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.