Does the SDK let me display locally stored shape files on the user's android device?
-We'd like to show the shape file of the local area and indicate to the user where they currently are.
- We'd also like t be able to add extra shape file layers for information of interest. e.g location of various types of assets.
If the SDK lets me do that can someone point me in the direction of the "how to"
cheers and thanks
Yes, the API supports the direct reading of shapefiles as of 10.2.4.
The code looks like this...
// Create shapefile feature table from path to .shp file
shapefileTable = new ShapefileFeatureTable("path/to/Shapefile.shp");
featureLayer = new FeatureLayer(shapefileTable);
// create a renderer
UniqueValueRenderer uvRenderer = new UniqueValueRenderer( new SimpleFillSymbol(new Color(0, 0, 0, 255), null), "CONTINENT");
// set renderer
Then, just add the featureLayer to your map, and there you go.
This is one of my favorite enhancements to the API!
thanks for that but i get an error on
UniqueValueRenderer uvRenderer = new UniqueValueRenderer( new SimpleFillSymbol(new Color(0, 0, 0,255), null), "CONTINENT");
to do with the incorrect number of arguments? are we working off different sdks ?
Have you ever read the articles below?
I'm developing with ArcGIS Runtime for Android 10.2.4 too, the .shp file was loaded and shown correctly.
I tested this with polygon features, so my code looks like this:
featureLayer.setRenderer(new SimpleRenderer(new SimpleFillSymbol(5, STYLE.VERTICAL)));
Maybe to check the feature type is helpful?
Yes you were working of diferent sdks, that was from Javascrip sdk.
Android renderer should look something like this:
|FeatureLayer mFlayer = new FeatureLayer(mTable);|
|mFlayer.setRenderer(new SimpleRenderer(new SimpleMarkerSymbol(Color.RED, 10, STYLE.SQUARE)));|