How to open shape file (*.shp) from SD Card ?

9098
20
04-25-2012 08:10 AM
mrphammrpham
New Contributor
Hi all !

How to open shape file (*.shp) from SD Card ?

Thank you all !
0 Kudos
20 Replies
agosh
by
New Contributor
i'd like to know 2
0 Kudos
JozefKaslikowski
New Contributor
i'd like to know 2


You can't with the api.

You could load the shapefile with a library and load all of the information into graphics layers. That would work, but the performance might not be acceptable.
0 Kudos
fihelMehdi
New Contributor
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
0 Kudos
mrphammrpham
New Contributor
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


Thank you .you can demo for example?
0 Kudos
fihelMehdi
New Contributor
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;
}
0 Kudos
weskeralbert
New Contributor II
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


hello,where can i download openmap and how to use in android?Thanks
0 Kudos
EnriqueIbarra
New Contributor III
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 rookie
Thanks!
0 Kudos
LukeCatania
New Contributor III
Please can you say to us where download from? and how use it, and if can you be a little more specific, I'm rookie
Thanks!


http://www.openmap.org/
0 Kudos
LukeCatania
New Contributor III
Please can you say to us where download from? and how use it, and if can you be a little more specific, I'm rookie
Thanks!


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
0 Kudos