Class Shape2Sql

java.lang.Object
com.reallifedeveloper.tools.gis.Shape2Sql

public class Shape2Sql extends Object
An example of how to use a ShapefileProcessor to create SQL insert statements for a particular type of shapefile.
Author:
RealLifeDeveloper
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Interprets a org.opengis.feature.Feature from a shapefile with bar information and processes it with a Shape2Sql.BarProcessor.
    static interface 
    Defines some kind of processing of bar information.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The character encoding used, both in the shapefile and in the SQL file being created, "UTF-8".
    static final int
    The SRID that identifies the coordinate system that is used in the shapefile and also in the SQL file being created.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    translate(URL shapefileUrl, OutputStream out)
    Reads a shapefile containing a map of bars, with information about the name and home page of each bar, and translates this into SQL insert statements appropriate for SQL Server.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SRID

      public static final int SRID
      The SRID that identifies the coordinate system that is used in the shapefile and also in the SQL file being created.

      In this example we use WGS 84 / Pseudo-Mercator, the same as is used by Google Maps, so SRID=3857.

      See Also:
    • CHARACTER_ENCODING

      public static final String CHARACTER_ENCODING
      The character encoding used, both in the shapefile and in the SQL file being created, "UTF-8".
      See Also:
  • Constructor Details

    • Shape2Sql

      public Shape2Sql()
  • Method Details

    • translate

      public void translate(URL shapefileUrl, OutputStream out) throws IOException
      Reads a shapefile containing a map of bars, with information about the name and home page of each bar, and translates this into SQL insert statements appropriate for SQL Server.
      Parameters:
      shapefileUrl - the URL where the shapefile can be found
      out - an OutputStream where SQL statements will be written
      Throws:
      IOException - if reading from shapefileUrl or writing to out failed