i'd like to know 2
you can work with openmap it has a class SHapefile and try to transform your shapefile to an graphicslayer it will work i've already done it
Please can you say to us where download from? and how use it, and if can you be a little more specific, I'm rookieThanks!
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; }
where to store the shapefiles in sd card (location path)?
File dbf = new File(Environment.getExternalStorageDirectory() + "/islreali/TabaYeud.dbf"); File shape = new File(Environment.getExternalStorageDirectory() + "/islreali/TabaYeud.shp"); File shx = new File(Environment.getExternalStorageDirectory() + "/islreali/TabaYeud.shx"); try { URL dbfUrl = dbf.toURI().toURL(); EsriPlugIn epi = new EsriPlugIn("name", dbfUrl, shape.toURI().toURL(), shx.toURI().toURL()); EsriGraphicList eGList = epi.getEsriGraphicList(); Map<Object, Object> attr = eGList.getAttributes(); } catch (Exception e) { e.printStackTrace(); }
"From where will I get SimpleMarkerSymbol class. I downloaded openmap 5.0 and the jars from there but could not find SimpleMarkerSymbol , Envelope , SpatialReference classes?"
Download code from:http://www.openmap.org/and then point to the jar files in the "lib" directory through the Java Build Path Libraries Tab in Eclsipse
Can you tell me how to use the openmap after add the lib?or show me a sample/tutorial of open shape file from SD card by openmap.
I ve tried to get the attribute using the following way File dbf = new File(Environment.getExternalStorageDirectory() + "/islreali/TabaYeud.dbf"); File shape = new File(Environment.getExternalStorageDirectory() + "/islreali/TabaYeud.shp"); File shx = new File(Environment.getExternalStorageDirectory() + "/islreali/TabaYeud.shx"); try { URL dbfUrl = dbf.toURI().toURL(); EsriPlugIn epi = new EsriPlugIn("name", dbfUrl, shape.toURI().toURL(), shx.toURI().toURL()); EsriGraphicList eGList = epi.getEsriGraphicList(); Map<Object, Object> attr = eGList.getAttributes(); } catch (Exception e) { e.printStackTrace(); } In the above code, it throws an error when it reach the place wher we use EsriPlugIn. I get Noclassdef error. I think this is not supported in android as read from the below linkhttp://openmap.bbn.com/mailArchives/openmap-users/2011-03/6671.htmlCud anyone advise me how to read the shapefile attributes by using some other method of openmap or some other api.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.