2

I'm working at OpenStreetMap project for android at the moment. I want to retrieve OSM data from my app(nodes, markers and paths) and convert it to shapefile (.shp, .dbf and .shx). Later, I'll load it into ArcGIS editor. I've been investigating about it, and I have no clear idea if It's possible a direct conversion between this formats, or I have to step first on KML file and parse it in shapefile.

I actually don't know how to retrieve the OSM data to save a OSM file for being treated. I've been looking for a library or something like that but I have no lucky.

Can anyone give me a helping hand?

  • What libraries are you using to on android? – neogeomat Sep 27 '13 at 3:24
1

Do you have to use shapefiles? They're kind of the lowest common denominator of GIS interchange formats. They will do bad things to field names > 10 characters.

To get your OSM data, there are lots of ways of doing it. A quick introduction is: Downloading data - OpenStreetMap Wiki. OSM data will need to be processed a bit to turn it into useful data. Will the data be downloaded and processed on an Android device, or will it be done on a computer beforehand? If the latter, you might consider SpataLite through GDAL. It will automatically create polygons from OSM's simple line features (example here: openstreetmap - How to import polygons from OSM to QGIS? - Geographic Information Systems Stack Exchange). SpatiaLite is supported under Android by the Spatialite for Android project (tutorial).

1

You could use gdal/ogr on android to do the conversion. Building gdal/ogr and spatiallite for android is not difficult if you have used the ndk before.

0

As such, the .osm format is a very simple format. It just contains the various nodes, and then the ways that are formed from these nodes. You could whip up some custom code which does this, quite easily.

Additionally, there are quite a few libraries/projects which can be used to convert from .osm format to shapefiles; Many of them have been linked on this page: https://wiki.openstreetmap.org/wiki/Shapefiles

  • I understand that the first step I have to take is create a XML or KML file for being treated and parsed lately to shape file. To make the xml/kml i Need to code a parser whom "transform" my map objects into tag language file, isn't it? Sorry for my ignorance, it's my first time working with parsers. – Leonis May 16 '13 at 11:49
  • Well, it depends on what you have right now. – Devdatta Tengshe May 17 '13 at 6:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.