我想创建应用程序以使用 GIS 形状文件 (.shp) 显示离线 map ,任何人都知道如何使用形状文件在 android 中显示 map 。
提前致谢
最佳答案
如果您从 SD 卡加载数据,您可以使用 openmap,它有一个 SShapefile 类,并尝试将您的 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 package is an Open Source JavaBeans TM based programmer's toolkit. Using OpenMap, you can quickly build applications and applets that access data from legacy databases and applications. OpenMap provides the means to allow users to see and manipulate geospatial information.
关于android - 如何在android中使用.shp文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12278689/