Class Shapefile


  • public class Shapefile
    extends java.lang.Object
    This class represnts an ESRI Shape file.

    You construct it with a file name, and later you can read the file's propertys, i.e. Sizes, Types, and the data itself.

    Copyright 1998 by James Macgill.

    Modified to allow reading the shapefile as a stream Martin Davis 2005-2007 Version 1.0beta1.1 (added construct with inputstream) 1.0beta1.2 (made Shape type constants public 18/Aug/98) This class supports the Shape file as set out in :-
    "ESRI(r) Shapefile - A Technical Description"
    'An ESRI White Paper . May 1997'

    This code is coverd by the LGPL.

    • Constructor Detail

      • Shapefile

        public Shapefile​(java.net.URL url)
        Creates and initialises a shapefile from a url
        Parameters:
        url - The url of the shapefile
      • Shapefile

        public Shapefile​(java.io.InputStream IS)
    • Method Detail

      • readStream

        public void readStream​(GeometryFactory geometryFactory)
                        throws java.io.IOException,
                               ShapefileException,
                               java.lang.Exception
        Initialises a shapefile from disk. Use Shapefile(String) if you don't want to use LEDataInputStream directly (recomened)
        Throws:
        java.io.IOException
        ShapefileException
        java.lang.Exception
      • next

        public Geometry next()
                      throws java.io.IOException
        Returns the next geometry in the shapefile stream
        Returns:
        null at EOF
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • getShapeTypeDescription

        public static java.lang.String getShapeTypeDescription​(int index)
        Returns a string for the shape type of index.
        Parameters:
        index - An int coresponding to the shape type to be described
        Returns:
        A string descibing the shape type
      • getShapeHandler

        public static ShapeHandler getShapeHandler​(Geometry geom,
                                                   int ShapeFileDimentions)
                                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getShapeHandler

        public static ShapeHandler getShapeHandler​(int type)
                                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • readIndex

        public void readIndex​(java.io.InputStream is)
                       throws java.io.IOException
        Throws:
        java.io.IOException