Re: [OpenMap Users] best way to get (lat,lon) pts from existing Shape files? or dbf files, and unstable view of shape files?

From: Don Dietrick <dietrick@bbn.com>
Date: Fri Dec 13 2002 - 13:12:55 EST

Hi Ed,

On Thursday, December 5, 2002, at 01:50 PM, Ed MacKerrow wrote:

> Dear Openmappers,
>  
> I am new to using shape files.  I have some existing shape files of
> the administration regions inside of nations (i.e. provinces or the
> equivalents of states).  I have tried using the ShpInputStream, and
> DbfInputStream classes inside OM to read these files, and I am not
> having much luck, since I am sure that I am going about things
> incorrectly. 
>  
> When I use the ShpInputStream methods I run out of memory on a 512 Mb
> RAM machine with a Shape file of size ~100Kb.

There is something going on. A 100Kb shape file is pretty small.

>   Probably some other bug in my code...  Here is a snippet for trying
> to read a .shp file and determine the geographic coordinate vectors
> that make up its constituent polygon regions.  My end goal is to the
> get the actual (lat,lon) pairs that make up the regions inside the
> polygons.

 <snip>

> I am probaly not going about this in the right way, and perhaps there
> are easier ways to achieve what I am doing, I am open for
> any suggestions and comments.

I'd copy the code from the EsriPlugIn, and make the same calls it is
making to read the shape files.

> And the third problem I am having is that I load some shape files,
> using a properties file as:
>  
> Shape file for administration areas of Afghanistan
> afghan.class=com.bbn.openmap.layer.shape.ShapeLayer
> afghan.prettyName=Afghanistan
> afghan.shapeFile=E:/proj/tapMerge/data/shape/Afghanistan/AFG_ADM1.SHP
> afghan.spatialIndex=E:/proj/tapMerge/data/shape/Afghanistan/
> AFG_ADM1.SHX
> afghan.lineColor=ff404040
> afghan.fillColor=ccffcc

The shx file isn't the spatial index file - the ssx file is the spatial
index file, and it gets created by OpenMap components. See:

http://dstl.bbn.com/dscgi/faqw.py?req=all#9.10

If the directory that the .shp file in is writable, you can ignore this
argument and it will be created automatically if it's not there.

>  #Shape file for administration areas of Algeria
> algeria2.class=com.bbn.openmap.layer.shape.ShapeLayer
> algeria2.prettyName=Algeria
> algeria2.shapeFile=E:/proj/tapMerge/data/shape/Algeria/dza_adm2.shp
> algeria2.spatialIndex=E:/proj/tapMerge/data/shape/Algeria/dza_adm2.shx
>  
> #Shape file for ecoregions
> ecoregions.class=com.bbn.openmap.layer.shape.ShapeLayer
> ecoregions.prettyName=eco regions
> ecoregions.shapeFile=E:/GIS/ecoRegions/ecoregions.shp
> ecoregions.spatialIndex=E:/GIS/ecoRegions/ecoregions.shx
> And only part of the actual files are viewable on my OpenMap image,
> and when I zoom in or out, some parts of the ShapeLayer disappear (I
> have turned the other map layers off etc. to make sure nothing is
> covered up.).  Since this is my first time ever using shape files I am
> most likely not going about things in the most efficient way.

You can use the EsriPlugIn as well as the ShapeLayer, although they
have different properties (see the java docs). The PlugIn uses the dbf
file and you can access that information via the palette for the
plugin, but the ShapeLayer works better for larger, background-type
Shape files.

Hope this helps,

Don 

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, BBN Technologies, dietrick@bbn.com
10 Moulton Street, Cambridge, MA 02138
617-873-3031 [fax]-2794
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

--
[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 Fri Dec 13 13:20:57 2002

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:33 EDT