Re: [OpenMap Users] what class do you use to extract data from .SHP files?

From: C S <usmsci_at_yahoo.com>
Date: Wed, 29 Oct 2008 11:06:32 -0700 (PDT)

what i mean is is that i have this code:

i am currently using the ESRIRecord and Shapefile class to go through the "records" of each shapefile which is actually each individual shape that is represented in the shapefile. each record has a bounding box and i am able to get this information but havent found a way to actually retrieve the points inside each record.
 
i am using these classes:

http://openmap.bbn.com/doc/api/com/bbn/openmap/layer/shape/ShapeFile.html
http://openmap.bbn.com/doc/api/com/bbn/openmap/layer/shape/ESRIRecord.html
http://openmap.bbn.com/doc/api/com/bbn/openmap/layer/shape/ESRIBoundingBox.html
 
i currently have something like:
 
try
     {
         shapeRecord = shapefile.getNextRecord(); //returns an ESRIRecord
     }
     catch(Exception e)
     {
         throw new Exception("problem getting the next record");
     }
 
this points me to the first record in the shapefile...i..e Shape 0.
 
  i can now say:
 
        shapeBox = shapeRecord.getBoundingBox(); //returns a bounding box for this particular record.
 
 now you can do:
 
       System.out.println("first point: " + shapeBox.min + " " + shapeBox.max);
 
  that yields me the bounding box for that particular record which would be -89.523, 30.616 and -89.495, 30.648 as shown below.
 
  Shape:0 (Polygon) nVertices=122, nParts=1
  Bounds:( -89.523, 30.616, 0, 0)
      to ( -89.495, 30.648, 0, 0)
     ( -89.512, 30.648, 0, 0) Ring
     ( -89.508, 30.648, 0, 0)
     ( -89.503, 30.648, 0, 0)
     ( -89.500, 30.648, 0, 0)
     ( -89.495, 30.648, 0, 0)
      etc etc etc
 
 
   now i want to be able to get all the points for the particular record but there isnt anything in the ESRIRecord class that gives me that ability and nothing in the ShapeFile class that allows me to call a function to actually return to me an array of points in the record or a buffer of some sort. ShapeFile does have a recBuf that returns data from a record but it is protected so i do not have access to it.

   i was hoping that there would be something like the DBFTableModel where i could just get an array of points in the record and then read all the points in the record..something like record.getLatLon(int index) that would return to me an ESRIPoint.

anyone have any clues or suggestions? thanks in advance!


--- On Tue, 10/28/08, andy qiu <rongxuqiu_at_gmail.com> wrote:

> From: andy qiu <rongxuqiu_at_gmail.com>
> Subject: Re: [OpenMap Users] what class do you use to extract data from .SHP files?
> To: usmsci_at_yahoo.com
> Date: Tuesday, October 28, 2008, 7:14 PM
> hi,
> GIS has three types of shapfile:point,line,polygon.Points
> and lines
> constitute polygon. You can have point layer,line layer and
> polygon layer in
> GIS.
> Andy
>
> On Tue, Oct 28, 2008 at 10:19 PM, C S
> <usmsci_at_yahoo.com> wrote:
>
> > hi all, i am new to the mailing list interested in
> writing a java
> > application that reads and manipulates shapefiles.
> >
> > i have currently successfully written code to read DBF
> files to extract
> > data for each row and column using the DBFTableModel.
> >
> > i am not an ESRI person by trade so i am all new to
> this. i dont know what
> > ESRI calls each shape within a shapefile..is it an
> ESRIGraphicsList for
> > example?
> >
> > File Bounds: ( -89.632, 30.174,0,0)
> > to ( -89.323, 30.648,0,0)
> >
> > Shape:0 (Polygon) nVertices=122, nParts=1
> > Bounds:( -89.523, 30.616, 0, 0)
> > to ( -89.495, 30.648, 0, 0)
> > ( -89.512, 30.648, 0, 0) Ring
> > ( -89.508, 30.648, 0, 0)
> > ( -89.503, 30.648, 0, 0)
> > ( -89.500, 30.648, 0, 0)
> > ( -89.495, 30.648, 0, 0)
> > ( -89.496, 30.647, 0, 0)
> > ( -89.496, 30.646, 0, 0)
> > ( -89.496, 30.645, 0, 0)
> > ( -89.497, 30.645, 0, 0)
> > ...............................
> > ...............................
> > ...............................
> >
> > i would like to just simply be able to traverse
> through each shape within
> > the shapefile, store all the data into memory and use
> it how i need to. i am
> > just not experienced enough with esri lingo to know
> what class i need to use
> > to get this data.
> >
> > can someone help ?? thanks in advance!!
> >
> >
> >
> >
> >
> > --
> > [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"]
> >


      

--
[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 Wed Oct 29 2008 - 14:08:34 EDT

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