[mapserver-users] HOw to create shp, etc files

Ma marin at here.is
Fri Dec 7 13:15:32 EST 2001


Grant,

use  FShape. great, free  software part of JShape WWW GIS.
http://www.jshape.com/index0.html
http://www.jshape.com/2xdownload/fshape.2x.zip
here is the  fshape.txt

--
Ma


------------------------------------------------------------------------------
FShape 2.19, Copyright 2000 from JShape Software
------------------------------------------------------------------------------

  FShape is an utility to allow users to manipulate their shapefiles in the
several ways. FShape is a Java application (not an applet), so users need to
have the Java JDK 1.1+ (free from SUN, http://java.sun.com) installed to run it.

  The shapefile system from ESRI basicly contains three parts :

  shape.shp : file contains feature records
  shape.shx : file contains feature indexes
  shape.dbf : file contains attribute records

  JShape (Java Shapefile browser) only requires ".shp" file to display GIS
information, but ArcView needs at least the above three files to function
properly.

  FShape can display, scale, offset, fuzzy, compress, grid and encrypt the
information of a shapefile. To run FShape, users need to have the Java
Interpreter (from Sun Java JDK or equivalents) available. The basic syntax
of FShape program likes the following :

  java fshape [shapefile] [command] [key:encryption-key]

FShape currently supports the following commands :

  (1) scale:value -> scale X, Y dimensions by [value]
        For Example : java fshape myshapefile.shp scale:1000

  (2) xscale:value -> scale X dimension by [value]
        For Example : java fshape myshapefile.shp xscale:0.025

  (3) yscale:value -> scale Y dimension by [value]
        For Example : java fshape myshapefile.shp yscale:25

  (4) xoff:value -> offset X dimension by [value]
        For Example : java fshape myshapefile.shp xoff:25

  (5) yoff:value -> offset Y dimension by [value]
        For Example : java fshape myshapefile.shp yoff:-25

  (6) fuzzy:value -> fuzzy the shapefile by factor [value]
        The fuzzy value is (feature removed size)/(feature extent size).
        The valid fuzzy value is between 1 and 0.
        For Example : java fshape myshapefile.shp fuzzy:0.01
        The above command removes the feature segments which sizes are
        less than 1/100 of the feature extent size.

  (7) index -> create a shape index file (.shx)
        For Example : java fshape myshapefile.shp index
        The above command will create a shape index file myshapefile.shx.

  (8) compress -> create a compressed shapefile (.csp)
        For Example : java fshape myshapefile.shp compress
        The above command will create a compressed shapefile myshapefile.csp.

  (9) compress key:encryption-key -> create an encrypted compressed shapefile
(.ecp)
        For Example : java fshape myshapefile.shp compress
key:http://shiuhlin.ml.org
        The above command will create an encrypted compressed shapefile
        myshapefile.ecp, and this file is useful only from
"http://shiuhlin.ml.org"
        web site.

  (A) grid:M:N:AIF -> create grid shapefiles
        M : number of grids in X dimension (1 .. 100)
        N : number of grids in Y dimension (1 .. 100)
        AIF : (optional) Attribute Information File
        For Examples :
        (1) java fshape myshapefile.shp grid:3:2
            The above command will create the following files :
              myshapefile.grd : grid control file which used by JShape
              myshapefile.0000.gsp : grid cell [0,0] shapefile
              myshapefile.0001.gsp : grid cell [0,1] shapefile
              myshapefile.0100.gsp : grid cell [1,0] shapefile
              myshapefile.0101.gsp : grid cell [1,1] shapefile
              myshapefile.0200.gsp : grid cell [2,0] shapefile
              myshapefile.0201.gsp : grid cell [2,1] shapefile
        (2) java fshape myshapefile.shp grid:3:2:myinfofile.txt
            The above command will create the following files :
              myshapefile.grd : grid control file which used by JShape
              myshapefile.0000.gsp : grid cell [0,0] shapefile
              myshapefile.0000.aif : grid cell [0,0] attribute information file
              myshapefile.0001.gsp : grid cell [0,1] shapefile
              myshapefile.0001.aif : grid cell [0,1] attribute information file
              myshapefile.0100.gsp : grid cell [1,0] shapefile
              myshapefile.0100.aif : grid cell [1,0] attribute information file
              myshapefile.0101.gsp : grid cell [1,1] shapefile
              myshapefile.0101.aif : grid cell [1,1] attribute information file
              myshapefile.0200.gsp : grid cell [2,0] shapefile
              myshapefile.0200.aif : grid cell [2,0] attribute information file
              myshapefile.0201.gsp : grid cell [2,1] shapefile
              myshapefile.0201.aif : grid cell [2,1] attribute information file

  (B) grid:M:N:AIF key:encryption-key -> create encrypted grid shapefiles
        M : number of grids in X dimension (1 .. 100)
        N : number of grids in Y dimension (1 .. 100)
        AIF : (optional) Attribute Information File (must be a text delimitered
file)
        For Examples :
        (1) java fshape myshapefile.shp grid:3:2 key:http://shiuhlin.ml.org
            The above command will create the following files :
              myshapefile.egd : encrypted grid control file which used by JShape

              myshapefile.0000.egp : grid cell [0,0] encrypted shapefile
              myshapefile.0001.egp : grid cell [0,1] encrypted shapefile
              myshapefile.0100.egp : grid cell [1,0] encrypted shapefile
              myshapefile.0101.egp : grid cell [1,1] encrypted shapefile
              myshapefile.0200.egp : grid cell [2,0] encrypted shapefile
              myshapefile.0201.egp : grid cell [2,1] encrypted shapefile
        (2) java fshape myshapefile.shp grid:3:2:myinfofile.txt
            The above command will create the following files :
              myshapefile.grd : grid control file which used by JShape
              myshapefile.0000.egp : grid cell [0,0] encrypted shapefile
              myshapefile.0000.aif : grid cell [0,0] attribute information file
              myshapefile.0001.egp : grid cell [0,1] encrypted shapefile
              myshapefile.0001.aif : grid cell [0,1] attribute information file
              myshapefile.0100.egp : grid cell [1,0] encrypted shapefile
              myshapefile.0100.aif : grid cell [1,0] attribute information file
              myshapefile.0101.egp : grid cell [1,1] encrypted shapefile
              myshapefile.0101.aif : grid cell [1,1] attribute information file
              myshapefile.0200.egp : grid cell [2,0] encrypted shapefile
              myshapefile.0200.aif : grid cell [2,0] attribute information file
              myshapefile.0201.egp : grid cell [2,1] encrypted shapefile
              myshapefile.0201.aif : grid cell [2,1] attribute information file

  (C) agrid:AIF:Field -> create attribute grid shapefiles
        AIF : Attribute Information File (must be a text delimitered file)
        Field : Attribute Field Number
        For Examples : There are two fields (NAME and POPULATION) in
myshapefile.txt.
        Using the following line to create the Attribute Grid for the NAME
field.
          (1) java fshape myshapefile.shp agrid:myshapefile.txt:1
        Using the following line to create the Attribute Grid for the POPULATION
field.
          (2) java fshape myshapefile.shp agrid:myshapefile.txt:2

  (D) kvm:scale -> create kvm integer scaled shapefiles
        Scale values :
          (1) If the source shapefile is in the Lat-Long (small extent)
              projection, the desired scale value should be 1000+.
          (2) If the source shapefile is in the UTM or Albers (large extent)
              projections, the desired scale value should be 1.

  (E) If there is no command specified, FShape will display the detailed
      information of the shapefile, compressed shapefile, grid shapefile and
      shape index file.


------------------------------------------------------------------------------
Encrypted Compressed/Grid Shapefile
------------------------------------------------------------------------------

  Encrypted Compressed Shapefile (.ecs) and Encrypted Grid Shapefile (.egd/.egs)

are used to protect important JShape GIS datasets not copied or downloaded by
remote users for other purposes. For example, if you want to publish an
important
GIS data file "value.shp" to internet, but you don't want the remote users to
get
a copy of it. Here is the solution for this problem :

1. Execute the following commands to generate Encrypted Compressed Shapefile or
   Encrypted Grid Shapefile :

   (a) fshape value1.shp compress key:http://www.my.com to generate value1.ecp,
       which is encrypted with the key "http://www.my.com".

   (b) fshape value2.shp grid:10:10 key:http://www.my.com to generate value2.egd

       and a set of .egp files, which are encrypted with the key
"http://www.my.com".

2. In JShape applet HTML file, specify the following information :

   <param name="layer1" value="value1.ecp">
   <param name="layer2" value="value2.egd">

   Since the encrypted shaprefiles are specified, JShape client will use the
current
   HTTP URL as the key to decrypt the input files value1.ecp and value2.egd. If
the
   current HTTP URL is other than http://www.my.com, JShape client can not
process the
   input encrypted shapefiles.


Notes :

1. All encryption key are case sensitive.

2. JShape supports the smart URL matching. For Examples :

   (a) If you create a encrypted compressed shapefile value.ecp with the key
       "http://www.my.com", then JShape has no problem to access it from
       "http://www.my.com/gis/value.ecp" or "http://www.my.com/cad/value.ecp".

   (b) If you create a encrypted compressed shapefile value.ecp with the key
       "http://www.my.com/gis", then JShape has no problem to access it from
       "http://www.my.com/gis/value.ecp", but JShape can not access it from
       "http://www.my.com/cad/value.ecp".


------------------------------------------------------------------------------
dBase Files
------------------------------------------------------------------------------

FShape contains functions to process dBase (.dbf) attribute files. The syntax
of dBase file functions is :

java fshape dBaseFile [export | list] [field filter] [delimiter]

Here are some examples :

(1) java fshape myfile.dbf
>>> Display the field definitions of myfile.dbf to screen

(2) java fshape myfile.dbf list
>>> Display the all contents of myfile.dbf to screen

(3) java fshape myfile.dbf export
>>> Export all the fileds of myfile.dbf to a delimitered text (myfile.txt) file.

>>> The default delimiter "@" is used.

(4) java fshape myfile.dbf export 1:3:5
>>> Export the fields 1, 3 and 5 of myfile.dbf to a delimiter text (myfile.txt)
    file.
>>> The default delimiter "@" is used.

(5) java fshape myfile.dbf export 1:3:5 $
>>> Export the fields 1, 3 and 5 of myfile.dbf to a delimiter text (myfile.txt)
    file.
>>> The specified delimiter "$" is used.

(6) java fshape myfile.dbf export %
>>> Export all the fileds of myfile.dbf to a delimitered text (myfile.txt) file.

>>> "%" is the wildcard character used in FShape.
>>> The default delimiter "@" is used.

(7) java fshape myfile.dbf export % $
>>> Export all the fileds of myfile.dbf to a delimitered text (myfile.txt) file.

>>> "%" is the wildcard character used in FShape.
>>> The specified delimiter "$" is used.

Note: "*" character sometimes has problems used in Windows/DOS environments.


------------------------------------------------------------------------------
Export Shapefiles (.shp) to Text Input Files (.inp)
------------------------------------------------------------------------------

FShape provides the function to export shapefiless (.shp) to text input files
(.inp). The syntax of this export function is :

java fshape shapefile export


------------------------------------------------------------------------------
AGrid Text Database Table (.txt)
------------------------------------------------------------------------------

FShape provides the function to convert a text database table (.txt) into the
attribute grid database table which can be easily accessed through JShape Table
extension. The syntax of this function is :

java fshape agrid:[TableFile]:[TableField]

For example: java fshape fshape agrid:MyTable.txt:1


------------------------------------------------------------------------------
Important Notes
------------------------------------------------------------------------------

(1) Before you "FShape" your shapefiles, backup your original shapefiles first.

(2) FShape provides five primary functions :
    (a) rubber-band your shapefiles
    (b) fuzzy your shapefiles (cut down the shapefile size)
    (c) create the shape index file
    (d) create the compress shapefile
    (e) grid the shapefiles (divide a large shapefile into a set of small
        grid cell shapefiles)
    (f) create the shapefiles from the text input (.inp) files (there are
        three text input files (point.inp, arc.inp and polygon.inp) included
        in FSHAPE.ZIP. To convert them to shapefiles, just execute :
        fshape point.inp
        fshape arc.inp
        fshape polygon.inp
    (g) encrypt your shapefiles
    (h) process dBase (.dbf) files

(3) JShape (Java Shapefile browser) does not require the shape index (.shx)
    files, but ArcView does require the shape index (.shx) files. If you
    rubber-band/fuzzy a shapefile and want it to be displayed in ArcView,
    you need to re-create a shape index (.shx) file with FShape.

------------------------------------------------------------------------------





Grant Marblestone wrote:

> Howdy all again,
>
> I am going to ask a basic question right now and I hope not to be too
> ridiculed!
>
> How does one create a shp file and the files that accompany it.
>
> I basically need to make a map of gps positioned dots containg a field of 10
> chars in length.
>
> Thanks so much for the advice,
>
> Grant






More information about the mapserver-users mailing list