Select to view content in your preferred language

Import a previously exported map into a map using Android SDK

1071
1
03-25-2014 05:13 AM
michaelsamuels
Emerging Contributor
What I wish to do seems so absurdly simple, and yet I'm having the devil of a time trying to make it happen. I've already spent at least 12 hours researching, trying, failing, and researching again.  I can only conclude that I do not understand ArcGIS, or the ArcGIS culture and terminology well enough to pose the right question.  It's like being in a foreign country trying to ask somebody directions.  It's really getting frustrating.

My client, for whom I've been charged to create an Android app, has been an ArcGIS user for some time.  Many years ago, his organization created a bike route map for his region.  He has exported it, send it to me and said, "Put this on the Android app I'm having you develop."  His export resulted in the following files: .dbf, .shp, .prj, .spn, .spx, .xml, and .shx files.

He says that it's a simple matter for him to share these exported files to another ArcGIS user, and that that other person can easily import them into his map.

That's all I want to do. 

I have been able to successfully load maps into my Android app; I've added graphics layers; I've done touch popups off of the map.  It's a wonderful tool; and I'm enjoying using it.  The documentation is clear and thorough. 

But I can't figure out how to accomplish this seemingly simple task.

Mike
0 Kudos
1 Reply
ShellyGill1
Esri Contributor
Hi Mike,

I appreciate it can be really frustrating trying to understand a new system, hopefully we can help out with this simple request though.

Many years ago, his organization created a bike route map for his region.  He has exported it, send it to me and said, "Put this on the Android app I'm having you develop."  His export resulted in the following files: .dbf, .shp, .prj, .spn, .spx, .xml, and .shx files.


What you have there is a shapefile - historically a rather old Esri format for geogaphic data - the 'shapefile' means basically at the very least the .shp, .shx and the .dbf files together (the other files are used by some bits of the system and not by others, but generally it does no harm at all to keep them all together when sharing them around - in particular the .prj is important to define the coordinate system of the shapefile, but you shouldn't need to explicitly be concerned with that). Its still in frequent use in many systems, and did become somewhat of a de-facto standard, but it's an old format and has certain limitations. In any case, a shapefile can contain a single 'layer' of data from a map.

The Android SDK does not support loading and displaying shapefiles, so that's one obvious problem you have right there. Although we may add support for different data formats as we release new versions of the SDK, typically the SDK has been focused around displaying services - you can find out more about the sorts of things that are supported now here:https://developers.arcgis.com/android/guide/map-layer-types.htm#ESRI_SECTION1_56C39AB97812490786CC06...

Many years ago, his organization created a bike route map for his region.
 

So here, your 'map' can refer to many different things. Esri's platform includes ArcGIS Online - this is the cloud part f the system, and stores maps as 'webmaps' - they only contain data from services, not local files. However, one useful thing is you can upload shapefiles to ArcGIS Online and then add them to a map.

If your shapefile is not too big (not more than 1000 features) then using a completely free public account for ArcGIS Online, you could upload the shapefile - this will convert the features in the shapefile into features that get stored in the map online (it's stored as JSON). Then you can easily load this map using the WebMap class in the Android SDK, from where it resides online.

A limitation would be that free accounts can only share data publicly - e.g. anyone could look at this data if they searched for it, although they would not be able to change anything, but they could save their own separate copy of it. Alternatives exist for paid subscriptions to ArcGIS, but that's probably getting a bit over complicated at this point for you. Also, all this assumes your device will be showing online data - it's not on the device itself. If the user however has a paid subscription for ArcGIS (which many esri users do have - if he pays maintenance for ArcGIS Desktop, then he should have as part of the desktop maintenance), then it's worth investigating what the paid subscriptions offer, possibly starting here: http://doc.arcgis.com/en/arcgis-online/reference/what-is-agol.htm).

I just imported a shapefile and shared it in this map that I shared publicly: http://www.arcgis.com/home/webmap/viewer.html?webmap=c40369868c22454ebac5c2f241d50704
- you should be able to use this to test out what I described. Look at this sample for how to load a webmap - it actually includes a lot more code than you need but you can see the code that uses a webmap URL to create a MapView - https://developers.arcgis.com/android/sample-code/webmap-popup-viewing. Then if this works for you, you can make your own Esri account yourself, or have your user save the data to their own account.

Other ways to work around the lack of shapefile support exist, especially if you have some flexibility with how your data can be exported, but using a webmap might be the easiest place to start.
Hope this info helps some, do post back if you have other questions about it.
0 Kudos