OsmDroid与shapefile

Because the project has recently updated a bit concerned about OsmDroid ( https://github.com/osmdroid/osmdroid ) project, we found that has been updated to version 6.1.5, remove most of the bug fixes, but also more of a very brisk ----- feature updates the support shapeFile.

In the source code can be seen in more than a "osmdroid-shape" of the project, as follows:

Android in our program to add direct reference to increase this package,

Then the following code to load the shapefile data into the map control:

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

Wherein myshape .shp file storage path is, the attributes of each feature will be automatically set to the overlayer to the title in this property.

Try a little rough, line data will be presented in the form Polyline objects in the map, then Point Marker will be in the form of the object.

But to be noted that support for the shapefile seemingly only supports UTF-8 encoded form, GBK, the situation and the garbled some of the properties of a read failure occurs.

Published 16 original articles · won praise 2 · Views 3503

Guess you like

Origin blog.csdn.net/weixin_41012454/article/details/103808602