Re: [OpenMap Users] Fill a shape file Polygon based on its attribute

From: Don Dietrick <dietrick@bbn.com>
Date: Fri Oct 31 2003 - 10:55:23 EST

Hi Christian,

This is what the AreaShapeLayer is for
(com.bbn.openmap.layer.shape.areas.AreaShapeLayer).

There are additional properties you need to set in order to use the
attributes to set drawing attributes values on those shapes.

 From the com.bbn.openmap.layer.shape.area.AreaHandler java doc:

  layer.class=com.bbn.openmap.layer.shape.areas.AreaShapeLayer
  layer.prettyName=Layer Name
  layer.shapeFile=/usr/local/data/shape/shapefile.shp
  layer.spatialIndex=/usr/local/data/shape/shapefile.ssx

  # Now, provide a data file that says what the shapes in the .shp
  # file are. You can use the DBF file:
  layer.dbfFile=/usr/local/data/shape/shapefile.dbf
  # OR a csv file, created yourself or from the .dbf file. There
  # should be the same number of entries in the .csv file that are in
  # the .shp file.
  layer.csvFile=/usr/local/data/shape/shapefile.csv
  # An attribute to tell the AreaHandler to skip over the first row
  # of the csv file if it contains descriptive column header names.
  layer.csvFileHasHeader=true

  # Default DrawingAttributes properties for everything not defined
  # specifically:
  layer.lineColor=ff000000
  layer.fillColor=ffff00ff

  # Now add any other attributes accepted by the DrawingAttributes
  # object, with the prefix as stated above, i.e. layer.lineColor)
  #
  # The first column index is 0, not 1.
  #
  # The key index specifies which column in the csv file contains
  # unique area names that are listed in the areas list here in the
  # properties. In this case, it's the column that contains MA in one
  # of its rows.
  layer.keyIndex=4

  # The name index is the column in the csv file that contains what
  # should be displayed in the application when a shape is chosen - the
  # object's proper name.
  layer.nameIndex=4
  layer.areas=MA RI
  layer.areas.MA.fillColor=ffff0000
  layer.areas.MA.lineColor=ff00ff00
  layer.areas.RI.fillColor=ffff0000
  layer.areas.RI.lineColor=ff00ff00

You can use the com.bbn.openmap.dataAccess.shape.DbfTableModel on the
dbf file to see which columns the key attributes are in.

Hope this helps,

Don

On Oct 31, 2003, at 10:14 AM, Christian Weaves wrote:

> Hopefully this should be straight forward enough,
>
> How would I (from a properties file) fill just one polygon with a
> certain color based on an attribute?
>
> * I want to color the caspian sea blue, here's my properties snippet:
>
> Coastline.class=com.bbn.openmap.layer.shape.ShapeLayer
> Coastline.prettyName=Coastline
> Coastline.shapeFile=data/shape/semi_detailed_world.shp
> Coastline.spatialIndex=data/shape/semi_detailed_world.ssx
> Coastline.lineColor=ff000000
> Coastline.fillColor=ffbdde83
>
> The attribute for the caspian sea is CTRY25M=550, So I need something
> like this:
> Coastline.CTRY25M.fillColor=eeff0093 where value=550
>
> How do I write this in a properties file?? Is it possible?
>
> Thanks very much, chris.!!
>
>
>
> --
> [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"]
>

--
[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 Oct 31 10:55:22 2003

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