POST
|
Hi, I'm trying to follow this sample code https://developers.arcgis.com/net/latest/android/sample-code/featurelayergeopackage.htm#GUID-D49CFDE6-F2D0-4B8E-96AF-70259C8EFB63 but in JAVA, using this file https://www.arcgis.com/home/item.html?id=68ec42517cdd439e81b036210483e8e7. When I try to get the feature layer (line 51) the list is empty. Did I do something wrong? import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.LinearLayout;
import com.esri.arcgisruntime.data.FeatureTable;
import com.esri.arcgisruntime.data.GeoPackage;
import com.esri.arcgisruntime.layers.FeatureLayer;
import com.esri.arcgisruntime.mapping.ArcGISMap;
import com.esri.arcgisruntime.mapping.Basemap;
import com.esri.arcgisruntime.mapping.view.MapView;
import java.io.File;
public class MainActivity extends AppCompatActivity {
private MapView mapView;
private final String filename = "AuroraCO.gpkg";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
createLayout();
initialize();
}
private void createLayout() {
LinearLayout linearLayout = new LinearLayout(this);
linearLayout.setOrientation(LinearLayout.VERTICAL);
mapView = new MapView(this);
linearLayout.addView(mapView);
setContentView(linearLayout);
}
private void initialize() {
new AsyncTask<Void, Void, Void>() {
@Override
protected void onPreExecute() {
mapView.setMap(new ArcGISMap(Basemap.Type.LIGHT_GRAY_CANVAS, 39.7294, -104.8319, 9));
}
@Override
protected Void doInBackground(Void... voids) {
String geoPackagePath = getGeoPackagePath();
final GeoPackage geoPackage = new GeoPackage(geoPackagePath);
geoPackage.addDoneLoadingListener(new Runnable() {
@Override
public void run() {
FeatureTable featureTable = geoPackage.getGeoPackageFeatureTables().get(0);
final FeatureLayer featureLayer = new FeatureLayer(featureTable);
featureLayer.addDoneLoadingListener(new Runnable() {
@Override
public void run() {
mapView.getMap().getOperationalLayers().add(featureLayer);
}
});
featureLayer.loadAsync();
}
});
geoPackage.loadAsync();
return null;
}
}.execute();
}
private String getGeoPackagePath() {
String folder = "/storage/emulated/0/labs/";
File file = new File(folder + filename);
if(!file.exists()){
return "";
}
return file.getPath();
}
}
... View more
01-29-2018
09:31 AM
|
0
|
0
|
1150
|
POST
|
Hi, our offline map application recently started to crash when running on ASUS Zenfone 3 (and only on that device). The error happens when you try to open the map. This is the message that appears in logcat: A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x4 in tid 20709 Any clue what might be causing this, specifically in this model?
... View more
01-25-2018
07:30 AM
|
0
|
1
|
484
|
POST
|
Hello! I'm trying to check if a feature table (from a geodatabase created in ArcMap 10.3 and also in 10.5, as described here http://desktop.arcgis.com/en/arcmap/10.3/map/working-with-arcmap/creating-arcgis-runtime-content.htm) has geometry, but it always returns false. The original .mxd file always have at least one layer with geometry. When I debugged the code I noticed that the data inside the tables was inaccessible. getType() returns "UNKNOW", getFields() returns null and so on. Here's the sample code I followed from this link https://developers.arcgis.com/android/latest/sample-code/feature-layer-geodatabase.htm
FeatureLayer geometryLayer;
final Geodatabase localGeodatabase = new Geodatabase(geodatabasePath);
localGeodatabase.addDoneLoadingListener(new Runnable() {
@Override
public void run() {
for(GeodatabaseFeatureTable featureTable : localGeodatabase.getGeodatabaseFeatureTables()) {
if(featureTable.hasGeometry()){
dataLayer = new FeatureLayer(featureTable);
return;
}
}
}
}
localGeodatabase.loadAsync(); Did I do something wrong? I'm using API 100.1 for android
... View more
12-07-2017
08:39 AM
|
0
|
0
|
561
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|