Re: [OpenMap Users] shapefile header fields, File Length

From: Don Dietrick <dietrick_at_bbn.com>
Date: Tue, 20 Oct 2009 11:33:46 -0400

Hi Nathan,

I admit I haven't tested this method of doing this, but your code
looks like it should work. I'll give it a shot later.

  If I were going to create a shape file, I'd do something like this;

OMGraphicList omgl = new OMGraphicList();

... add OMGraphics to omgl

DbfTableModel dbf = new DbfTableModel(..);

... add entries appropriate for OMGraphics

EsriShapeExport ese = EsriShapeExport(omgl, dbf, my_file_path);
ese.export();

- Don

On Oct 20, 2009, at 10:44 AM, Reese, Nathan wrote:

> I am creating a shapefile with polygons. Below is the code fragment
> that I am using to generate a shapefile, I have omitted dbf and shx
> code for simplicity. Let me know if you need any additional
> information.
>
> EsriLayer polygonLayer = new EsriLayer("testShapefile",
> ShapeConstants.SHAPE_TYPE_POLYGON, 7);
>
> //Build dbf table
> ...
>
> //Build layer
> while (ellipses to add to layer) {
> OMEllipse ellipse = new OMEllipse(centerPoint, majorAxis,
> minorAxis, Length.NM, Math.toRadians(azimuth-90));
> float[] ellipsePoints = ellipse.createLatLonPoints();
> EsriPolygon poly = new EsriPolygon(ellipsePoints, 1, 0);
> ArrayList<String> attributes = new ArrayList<String>();
> ...
> polygonLayer.addRecord(poly, attributes);
> }
>
> //Write file
> FileOutputStream shpFileStream = new FileOutputStream
> ("testShapefile.shp");
> ShpOutputStream shpStream = new ShpOutputStream(shpFileStream);
> EsriGraphicList list = polygonLayer.getEsriGraphicList();
> int[][] imageData = shpStream.writeGeometry(list);
>
> //write dbf and shx files
> ...
>
> shpFileStream.close();
>
>
> Thanks,
>
> Nathan
>
> -----Original Message-----
> From: Don Dietrick [mailto:dietrick_at_bbn.com]
> Sent: Mon 10/19/2009 2:37 PM
> To: Reese, Nathan
> Cc: openmap-users_at_bbn.com
> Subject: Re: [OpenMap Users] shapefile header fields, File Length
>
> Hi Nathan,
>
> The file length is calculated for the shapes being placed in the
> file. What kind of shape type are you creating a file for, and what
> classes are you using to do it?
>
> - Don
>
> On Oct 19, 2009, at 1:41 PM, Reese, Nathan wrote:
>
> > I am having problems opening shapefiles generated with OpenMap using
> > various GIS applications (although the shapefile can be opened in GE
> > and with ArcGIS). The shapefiles can only be opened by all GIS
> > applications by first opening and resaving the file with ArcGIS.
> >
> > I have compared the orginal .shp file with the ArcGIS updated .shp
> > and have found that the only difference is in the File Length field
> > in the main file header (byte 27). I have tried using the ShapeFile
> > class to display the shapefile header information, but that utility
> > always returns a value of 100 for the File Length. Has any one
> > experienced these types of problems. Does ShpOutputStream properly
> > set the File Length field in the main file header?
> >
> > Thanks,
> >
> > Nathan
> >
>
>
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Don Dietrick, openmap_at_bbn.com
> BBN Technologies, Cambridge MA, USA
> http://openmap.bbn.com
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
>
>
>

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Oct 20 2009 - 11:33:57 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:09 EDT