Hi Brian,
There's a new release impending, probably tomorrow morning that fixes
some bugs that I introduced in the package's debut. I'm not sure if it
will fix your problem, but it might? Can you let us know if it doesn't?
- Don
On Monday, November 19, 2001, at 07:36 PM, Schlining, Brian wrote:
> Hi,
>
>
>
> I'm trying to create a very large shapefile (~60,000,000 points). I'm
> doing this by breaking the data up into a series of polylines, each
> containing 30,000 points. I'm trying to to use the openmap API to
> create this file and have run into a few problems. 1st I tried this
> approach (simplified pseudo code):
>
>
>
> File shp = new File(shapeDir, shapeDir.getName() + ".shp");
>
> ShapeFile shapefile = new ShapeFile(shp);
>
> shapefile.setShapeType(ESRIRecord.SHAPE_TYPE_POLYLINE);
>
> ESRIPolygonRecord polyline = new ESRIPolygonRecord();
>
> polyline.setPolygon(false);
>
> // Store the lat, lon pairs in a float[][] called degBuf
>
> polyline.add(ProjMath.arrayDegToRad(degBuf));
>
> shapefile.add(polyline);
>
> shapefile.close();
>
>
>
> DbfTableModel model =newDbfTableModel(1);
>
> model.setDecimalCount(0, (byte) 0);
>
> model.setLength(0, (byte) 10);
>
> model.setColumnName(0,"Tracks");
>
> model.setType(0, (byte) DbfTableModel.TYPE_CHARACTER);
>
> DbfOutputStream dbfOut =newDbfOutputStream(newFileOutputStream(dbf));
>
> dbfOut.writeModel(model);
>
>
>
> This creates the .shp and the .dbf file, both of which seem fine, but I
> don't know how to get the indexing for the .shx file. Is there some
> simple way to generate the indexing required for the .shx file? The
> alternative method is:
>
>
>
> EsriLayer layer =
>
> newEsriLayer(shapeDir.getAbsolutePath(),
>
> EsriLayer.TYPE_POLYLINE, 1);
>
> OMGraphicList shapeData =newOMGraphicList();
>
> ArrayList tabularData =newArrayList();
>
>
>
> // Create a record to store the polyline
>
> OMPoly polyline =null;
>
>
>
> File shp =newFile(shapeDir, shapeDir.getName() +".shp");
>
> File dbf =newFile(shapeDir, shapeDir.getName() +".dbf");
>
> File shx =newFile(shapeDir, shapeDir.getName() +".shx");
>
>
>
> // Store the lat, lon pairs in a float[][] called degBuf
>
> polyline = newOMPoly(
>
> ProjMath.arrayDegToRad(degBuf),
>
> OMGraphic.DECIMAL_DEGREES,
>
> OMGraphic.LINETYPE_RHUMB);
>
> shapeData.add(polyline);
>
> tabularData.add(0,"ship tracks");
>
> layer.addRecord(shapeData, tabularData);
>
> EsriGraphicList shapes =newEsriGraphicList(EsriLayer.TYPE_POLYGON);
>
> shapes.add(shapeData);
>
>
>
>
>
> ShpOutputStream shpOut =newShpOutputStream(newFileOutputStream(shp));
>
> int[][] shxData = shpOut.writePolyGeometry(shapes);
>
> ShxOutputStream shxOut =newShxOutputStream(newFileOutputStream(shx));
>
> shxOut.writeIndex(shxData, EsriLayer.TYPE_POLYLINE);
>
>
>
>
>
> DbfTableModel model =newDbfTableModel(1);
>
> model.setDecimalCount(0, (byte) 0);
>
> model.setLength(0, (byte) 10);
>
> model.setColumnName(0,"Tracks");
>
> model.setType(0, (byte) DbfTableModel.TYPE_CHARACTER);
>
> DbfOutputStream dbfOut =newDbfOutputStream(newFileOutputStream(dbf));
>
> dbfOut.writeModel(model);
>
>
>
> This generates a .shp file with no data in it. (Why?). And it looks
> like the .shx file is not being set correctly either. Any help is
> greatly appreciated
>
>
>
> Thanks
>
> B
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Brian Schlining
>
> Software Application Developer
>
> Monterey Bay Aquarium Research Institute
>
> brian@mbari.org
>
> (831) 775-1855
>
> http://www.mbari.org/~brian
>
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
>
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Donald Dietrick, dietrick@bbn.com
BBN Technologies, Cambridge, MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"]Received on Tue Nov 20 10:54:23 2001
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:32 EDT