I have access to some open data for which I want to obtain some coordinates to put onto a map. Unfortunately, the data is in the Shapefile format which is rather difficult to work with. I am trying to convert it to something easier, preferably geoJSON or some kind of XML-based document.

A requirement is to do this within the client's application in the event that the data changes, so unfortunately I am unable to use some online tool nor can I just open the data in QGIS and export the data in another format.

I attempted to write my own Shapefile parser however I ran into difficulty with IndexOutOfBoundsException while reading some of the records despite having shapes of type 1 (Point). Furthermore, there is a projection file that I have to deal with and I haven't been able to find much on how to map the coordinates according to a PRJ.

Is there any open-source library I can include in my application that can take a Shapefile collection (SHP, SHX, DBF, PRJ, SHP.XML) and convert it to geoJSON? I'm particularly looking into Java for Android/BlackBerry development, possibly Windows Phone in the far future.

  • in your mobile environment could you POST to and endpoint and the results be GeoJSON?
    – Jeryl Cook
    May 22, 2018 at 17:12

2 Answers 2


There are java bindings for GDAL/ogr - see http://gdal.org/java/ . No idea if they work on Android, though. Apparently ( https://www.google.de/search?q=gdal+on+android ) building gdal on Android is not really easy.

http://sourceforge.net/projects/javashapefilere/ seems to be another option.

Also https://stackoverflow.com/questions/2044876/does-anyone-know-of-a-library-in-java-that-can-parse-esri-shapefiles .


All the code you would need is available in GeoTools but it will probably not work in a mobile environment. However looking at the code might give you a start provided you can live with a LGPL license.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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