Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android lib to read or parse shapefile

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.

like image 681
Hugo Alves Avatar asked Oct 23 '13 17:10

Hugo Alves


1 Answers

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.

like image 64
LuisTavares Avatar answered Oct 20 '22 08:10

LuisTavares