nebsar / openmap

Automatically exported from code.google.com/p/openmap
Other
0 stars 0 forks source link

Trying to import .SHP files from a previously exported ArcGIS map into a graphics layer on Android #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The task I wish to perform seems so absurdly simple!  Somebody on one of the 
ArcGIS forums recommended this product.

The code I've written is very simple (see below).  The first record I read 
returns the error: Unknown shape type: 13.

Here's my code (and I'm attaching my .shp file):

        SpatialReference lSR = mapView.getSpatialReference();
        Envelope lEnvolope = mapView.getLayer(0).getFullExtent();
        GraphicsLayer graphicLayer = new GraphicsLayer(lSR, lEnvolope);

        try {
            File file = new File(shpfile);
            ShapeFile shp = new ShapeFile(file);
            SimpleMarkerSymbol c_point = new SimpleMarkerSymbol(Color.RED, 2, SimpleMarkerSymbol.STYLE.CIRCLE);   
            ESRIPointRecord e=null;
            boolean failed=false;
            boolean weredone=false;
            try {
                e = (ESRIPointRecord) shp.getNextRecord();
            } catch (Exception ee) {
                failed=true;
            }
            while (!weredone) {
                if(!failed) {
                    graphicLayer.addGraphic(new Graphic(new Point(e.getX(), e.getY()), c_point));
                }
                failed=false;
                try {
                    e = (ESRIPointRecord) shp.getNextRecord();
                    if (e==null) {
                        weredone=true;
                    }
                } catch (Exception ee2) {
                    failed=true;
                }
            }
           shp.close();
           } catch (IOException e1) {
           e1.printStackTrace();
           }
          return graphicLayer;
        }

Original issue reported on code.google.com by diamonds...@gmail.com on 25 Mar 2014 at 1:46

Attachments: