8

is there any library that is able to read parse a .shp file, preferably on where I don't need to use NDK. I was trying to use GeoTools but i can't seam to get it to work on Android.

Hugo Alves
  • 1,555
  • 2
  • 18
  • 41

1 Answers1

8

I've been using two lightweight shapefile parsers with good results in Android: diewald_shapeFileReader and Java ESRI Shape File Reader.

GeoTools relies heavily on AWT and Java Service Provider Interface (SPI) both not supported by Android. So it´s not a viable option.

EDIT 2021

Osmdroid library as of Mar 24st, 2019, Release: 6.1.0,

supports overlaying shapefiles using the Java ESRI Shape File Reader I mentioned previously.

Syntax:

List<Overlay>  folder = ShapeConverter.convert(mMapView, new File(myshape));
mMapView.getOverlayManager().addAll(folder);
mMapView.invalidate();

Where

myshape is a .shp file somewhere on the drive. If other metadata files are found, they will be used and injected into the converted shapes.

LuisTavares
  • 2,146
  • 2
  • 12
  • 18
  • please, tell me what are using to display .shp file eg. OSM or any other library, i need to implementation in my project. – Hardik Jul 31 '14 at 13:01
  • After parsing how will I display it on Google Maps?? – vishal gaurav Jun 27 '16 at 12:43
  • 1
    @LuísTavares how can we create files such as (.cpg, .dbf, .prj, .shp, .shx ) on Android application. Any suggested lib?? Thank you ! – sanjay Jul 03 '19 at 08:07
  • @LuísTavares thank you! Any other option? I mean can we create these files (.cpg, .dbf, .prj, .shp, .shx ) without using Android NDK on android application project? – sanjay Jul 03 '19 at 10:00
  • @LuísTavares Thank You !! I appreciate your help !! – sanjay Jul 03 '19 at 10:15