Hello,
I have downloaded the shapefile from this page:
Block Group Low Moderate 2000
I try to load it to my map by doing that:
File shapefile = new File(System.getProperty("data.dir"), "address");
ShapefileFeatureTable shapefileFeatureTable = new ShapefileFeatureTable(shapefile.getAbsolutePath());
// use the shapefile feature table to create a feature layer
FeatureLayer layer = new FeatureLayer(shapefileFeatureTable);
layer.addDoneLoadingListener(() -> {
System.out.println("Layer Loading : " + layer.getLoadStatus());
if (layer.getLoadStatus() == LoadStatus.LOADED) {
mapView.setViewpoint(new Viewpoint(layer.getFullExtent()));
} else {
Platform.runLater(new Runnable() {
@Override
public void run() {
ArcGISRuntimeException loadError = layer.getLoadError();
Throwable Cause = loadError.getCause();
String alertMessage = "(" + layerId + ") '" + portalItemID.title + "' Layer Error : "
+ loadError.getMessage() + (Cause == null ? "" : (" - Cause: " + Cause.getMessage()));
loadError.printStackTrace();
if(Cause != null)
Cause.printStackTrace();
Alert alert = new Alert(AlertType.ERROR, alertMessage);
alert.show();
}
});
}
});
layer.addLoadStatusChangedListener(new LoadStatusChangedListener() {
@Override
public void loadStatusChanged(LoadStatusChangedEvent loadStatusChangedEvent) {
System.out.println("(" + layerId + ") '" + portalItemID.title + "' LoadStatusChangedListener : "+ loadStatusChangedEvent.getNewLoadStatus().name());
}
});
mapView.getMap().getOperationalLayers().add(layer);
But, it doesn't work. I got the following message:
ArcGISRuntimeException: The field already exists.: FID
It also says:
Licensed For Developer Use Only
Would that be the cause?
Thank you for your help?