我想使用GIS形状文件(.shp)创建应用程序以显示离线地图任何人都知道如何使用形状文件在android中显示地图。
提前致谢
答案 0 :(得分:1)
如果你正在从SD卡加载数据,你可以使用openmap它有一个SHapefile类,并尝试将你的shapefile转换为一个图形层,它已经完成了。
static public GraphicsLayer SHPtoPOINT(String shpfile) {
SpatialReference lSR = SpatialReference.create(26192);
Envelope lEnvolope = getSHPEnvelope(shpfile);//to create an extent for your graphics layer
GraphicsLayer graphicLayer = new GraphicsLayer(lSR, lEnvolope);
try {
File file = new File(shpfile);
ShapeFile shp = new ShapeFile(file);
ESRIPointRecord e = (ESRIPointRecord) shp.getNextRecord();
SimpleMarkerSymbol c_point = new SimpleMarkerSymbol(Color.BLACK, 1,
STYLE.CIRCLE);
while (e != null) {
graphicLayer.addGraphic(new Graphic(new Point(e.getX(), e.getY()), c_point));
e = (ESRIPointRecord) shp.getNextRecord();
}
shp.close();
} catch (IOException e1) {
e1.printStackTrace();
}
return graphicLayer;
}
编辑:
BBN Technologies的OpenMap TM软件包是一个开源JavaBeans TM 基于程序员的工具包。使用OpenMap,您可以快速构建 从旧数据库访问数据的应用程序和小程序 应用。 OpenMap提供了允许用户查看和的方法 操纵地理空间信息。