How to get rid of this error: "Feature collection need to be projected"?

3184
1
06-30-2015 12:42 PM
CamiloMedina
New Contributor

Hello guys, I'm using

fl = new ArcGISFeatureLayer(getResources().getString(R.string.layerDefinition), fs, o);

to create a feature layer locally, where fs is a FeatureSet loaded from a .txt file in JSON format, and 'o' are options of type Options.

Both layerDefinition and featureSet are in WGS84 Spatial Reference (4326) and my basemap is initialized as follows:

map = new MapView(this, WEB_MERCATOR, new ArcGISLocalTiledLayer(Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + "ingenio_la_cabana" + "/" + "mapa_ingenio.tpk").getFullExtent());

The problem is that it shows this error "Feature collection need to be projected" when I try to load my FeatureLayer locally. This problem appears randomly; sometimes it crashes and doesn't load the layer and sometimes it works fine without touching any code.

Is this an Arcgis for Android bug? Or is it something I'm doing wrong?

Hope you can help me! thank you!

0 Kudos
1 Reply
WillCrick
Occasional Contributor

It looks like your data is in WGS84 and you are using a local tiled layer as your base layer (which sets the spatial reference of the entire MapView) in Web Mercator. Dynamic re-projection of feature layers from a feature set are not supported. You will have to either use another base layer in WGS84 or reproject your features into Web Mercator (using the Geometry Engine).

I hope that helps.

Will

0 Kudos