Package com.reallifedeveloper.tools.gis
Class Shape2Sql
java.lang.Object
com.reallifedeveloper.tools.gis.Shape2Sql
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 ClassesModifier and TypeClassDescriptionstatic class
Interprets aorg.opengis.feature.Feature
from a shapefile with bar information and processes it with aShape2Sql.BarProcessor
.static interface
Defines some kind of processing of bar information. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.
-
Field Details
-
SRID
public static final int SRIDThe 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
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
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 foundout
- anOutputStream
where SQL statements will be written- Throws:
IOException
- if reading fromshapefileUrl
or writing toout
failed
-