JASPA 0.2.0 Manual

Text is available under the Creative Commons Attribution-ShareAlike 3.0 License.


Table of Contents

1. Introduction
1. Overview
1.1. Description
1.2. Features
1.3. Changes from previous versions.
1.4. Versions
1.5. Future plans
1.6. Credits
1.7. Get Involved
2. License
2.1. JASPA Software
2.2. JASPA Documentation
3. Libraries and Tools used to create JASPA
3.1. Documentation
2. Frequently Asked Questions
1. JASPA Project
1.1. Why have you created JASPA?
1.2. How many versions of JASPA there are?
1.3. Who has developed JASPA?
1.4. Does JASPA support the OGC standards?
1.5. Can I participate in JASPA?
1.6. How can I show my interest in JASPA?
1.7. Where can I find a manual or tutorial to learn JASPA?
2. Spatial Data
2.1. What software can I use to display the spatial data stored in JASPA?
2.2. How can I import my cartography into JASPA?
2.3. Does JASPA support spatial indexes?
3. Errors during the installation
3.1. Starting the H2 server throws an error in the thread "main". org.h2.jdbc.JdbcSQLException: IO Exception: "java.net.UnknownHostException...
3.2. ldconfig command does not exist.
3.3. When I start or stop the postgres server, it does nothing and it does not return any message
3.4. When installing Jaspa for PostgreSQL, pljavainstall.sql runs seamlessly, but when I run the jaspa.sql file I get an error like: WARNING: java.lang.NoSuchMethodError: Method org.postgresql.pljava.internal.Portal._fetch (JZI):
3. Installation
1. Install from Binary Distribution
1.1. How to install JASPA for H2 in Windows
1.2. How to install JASPA for H2 in Linux
1.3. How to install JASPA for PostgreSQL in Windows
1.4. How to install JASPA for PostgreSQL in Linux
1.5. Important notes
2. Upgrading
2.1. Major Changes (a changes, b and c are the same)
2.2. Medium Changes (b changes, a and c are the same)
2.3. Minor Changes (c changes, a and b are the same)
3. Backup
3.1. Backup for PostgreSQL
3.2. Backup for H2
4. Compiling from source
4.1. Ensure you have Java and Maven
4.2. Copy the JASPA project directory
4.3. Uploading some jars to your local maven repository
4.4. Building
4.5. Copy the built jar file to the JASPA distribution
4.6. Acknowledgement
5. Configuration of JASPA in Eclipse IDE
5.1. Setting the Eclipse IDE using maven
5.2. Using m2eclipse plugin
4. Standards Implementation
1. Spatial Standards
1.1. OGC
1.2. ISO
1.3. JASPA implementation
2. Standards Disparity
2.1. Default SRID
2.2. Boolean
5. Spatial Data
1. Geometries
1.1. Types of Geometries
1.2. Properties
2. Functions Coordinate Dimension
3. Spatial Relationships
4. Formats
4.1. WKB
4.2. WKT
4.3. EWKB
4.4. EWKT
4.5. GML
4.6. KML
5. Metadata tables
5.1. Geometry Columns
5.2. Spatial Reference System
6. Coordinate System
6.1. WKT SRS
6.2. Reprojection
6.3. WKT Spheroid
7. Spatial indexes
7.1. Creating spatial indexes
7.2. Functions using spatial indexes
7.3. Examples
8. Connectors
8.1. Mapserver connector (libpq)
8.2. gvSIG 1.11
8.3. Kosmo
6. Topology
1. Introduction
2. Commands
2.1. Examples
3. Steps to create and validate a topology model
3.1. Create a topology model
3.2. Add layers to the topology model
3.3. Add rules to the topology model
3.4. Validate a topology
3.5. Obtain information about a topological model
3.6. Remove a rule
3.7. Remove a layer
3.8. Alter a layer
3.9. Remove a topological model
3.10. Change the transaction mode
4. Subtypes
4.1. Examples
4.2. Restriction on first layer
4.3. Restriction on second layer
4.4. Restriction on first and second layer
4.5. Restriction that involves first and second layer at the same time.
5. Tolerance
5.1. Cluster Tolerance
5.2. Rules with tolerance (_wt)
5.3. Search Window
6. Topology Rules
6.1. Summary of rules
6.2. Summary of rules in a single layer
6.3. Summary of rules between two layers
6.4. Point rules. Examples
6.5. Point + Point rules. Examples
6.6. Point +Line rules. Examples
6.7. Point +Polygon rules. Examples
6.8. Line rules. Examples
6.9. Line + Line rules. Examples
6.10. Line + Polygon rules. Examples
6.11. Polygon rules. Examples
6.12. Polygon + Point rules. Examples
6.13. Polygon + Line rules. Examples
6.14. Polygon + Polygon rules. Examples
7. Differences
1. Differences between JASPA and PostGIS
1.1. Box Data Type
1.2. Coordinate dimensions
1.3. Empty Geometries
1.4. Dump functions
2. Differences between JASPA for PostgreSQL and for H2
2.1. Letter Case
2.2. Casts
2.3. Arrays
2.4. Aggregates
2.5. Renamed Functions
8. Getting Started
1. Creating a new database
1.1. PostgreSQL
1.2. H2
1.3. Tutorial
2. Creating a table
2.1. PostgreSQL
2.2. H2
3. Inserting Data into a Spatial Table
3.1. OGC Functions
3.2. Shp Converter
3.3. Load data
3.4. Tutorial
3.5. SHP to SQL
3.6. Load SQL files
3.7. Jaspa to SHP
4. Spatial Indexes
5. Exercises
5.1. Basis Queries
5.2. Store Results in Tables and Views
5.3. Update a table
5.4. Intersection
5.5. Buffer
5.6. Dissolution
5.7. Distance queries
5.8. Coordinate Projection
9. Reference
1. Management Functions
AddGeometryColumn — Adds a spatial column to an existing feature table.
DropGeometryColumn — Drops a spatial column from an existing feature table.
DropGeometryTable — Drops a spatial table and its references in the metadata table geometry_columns.
UpdateGeometrySRID — Updates the SRID of the geometries in a particular geometry column. It also updates the geometry_columns metadata table and the srid table constraint.
Jaspa_Version — Returns Jaspa version number and phase of the release life cycle.
Jaspa_Full_Version — Returns the version of Jaspa and its libraries.
Jaspa_Java_Properties — Returns information about the OS and the JVM used.
Jaspa_Build_Date — Returns Jaspa version and build date.
Probe_Geometry_Columns — Explores all tables with Jaspa geometry constraints and adds them to the metadata table GEOMETRY_COLUMNS if they are not already there.
2. Geometry Constructors
ST_BdPolyFromText — Construct a Polygon given an arbitrary collection of closed linestrings as a MultiLineString text representation.
ST_BdMPolyFromText — Return a specified ST_MultiPolygon value.
ST_GeomCollFromText — Return a specified Geometry Collection object.
ST_GeomFromEWKB — Return a specified Geometry from a Extended Well-Known Binary representation (EWKB)
ST_GeomFromEWKT — Return a specified Geometry from a Extended Well-Known Text representation (EWKT)
ST_GeomFromText — Return a geometric object given its Well-known text Representation.
ST_GeomFromWKB — Construct a geometric object given its Well-known Binary Representation
ST_LineFromMultiPoint — Creates a LineString from a Multipoint.
ST_LineFromText — Returns a LineString object given its Well-known text Representation
ST_LineFromWKB — Returns a LineString object given its Well-known text Representation
ST_MakeBox2D — Creates a Box2d defined by the lower left point and the upper right point.
ST_MakeBox3D — Creates a Box3d defined by the lower left point and the upper right point.
ST_MakeLine — Creates a LineString from a number of points.
ST_MakePolygon — Creates a Polygon from a number of LineStrings.
ST_MakePoint — Creates a Point given its coordinates.
ST_MakePointM — Creates a Point given its x,y,m coordinates.
ST_MLineFromText — Constructs a MultiLineString object given its Well-known text Representation
ST_MPointFromText — Constructs a MultiPoint object given its Well-known text Representation
ST_MPolyFromText — Constructs a MultiPolygon object given its Well-known text Representation
ST_Point — Creates a Point given its coordinates. This is an Alias from ST_MakePoint
ST_PointFromText — Constructs a MultiPoint object given its Well-known text Representation
ST_PointFromWKB — Returns a Point object given its Well-known text Representation.
ST_Polygon — Creates a Polygon from a closed LineString and SRID.
ST_PolyFromText — Constructs a Polygon object given its Well-known text Representation
ST_WKBToSQL — Return a geometric object given its Well-known binary Representation. This is an alias for ST_GeomFromWKB.
ST_WKTToSQL — Return a geometric object given its Well-known text Representation. This is an alias for ST_GeomFromText.
ST_PolyFromWKB — Returns a LineString object given its Well-known text Representation
ST_MPointFromWKB — Returns a MultiPoint object given its Well-known binary Representation
ST_MLineFromWKB — Returns a MultiLineString object given its Well-known binary Representation
ST_MPolyFromWKB — Returns a MultiPolygon object given its Well-known binary Representation
ST_GeomCollFromWKB — Returns a GeometryCollection object given its Well-known binary Representation
ST_GeomFromGML — Construct a geometric object given its GML Representation
ST_GeomFromKML — Constructs a geometric object given its KML representation
ST_MakeGeomColl — Constructs a GeometryCollection object from a set of Geometries.
3. Geometry Accessors
GeometryType — Returns the name of the instantiable subtype of Geometry of which this geometric object is a member, as a string
ST_Boundary — Returns the closure of the combinatorial boundary of a Geometry
ST_CoordDim — Returns the coordinate dimension of the Geometry.
ST_Dimension — Returns the dimension of the geometric object, which is less than or equal to the dimension of the coordinate space.
ST_EndPoint — Returns a Point containing the last Point of a LineString
ST_Envelope — Returns a geometry object representing the minimum bounding box for the supplied Geometry.
ST_ExteriorRing — Returns the exteriorRing of a Polygon
ST_GeometryN — Returns the Nth geometry object in a Collection.
ST_GeometryType — Returns the name of the instantiable subtype of Geometry of which the input geometric object is a member, as a string
ST_InteriorRingN — —Returns the Nth interior ring for a Polygon as a LineString.
ST_IsClosed — Tests if a LineString is closed.
ST_IsEmpty — Tests if a Geometry corresponds to the empty set.
ST_IsRing — Tests if a LineString is a ring
ST_IsSimple — Tests if a Geometry has no anomalous geometric points, such as self intersection or self tangency.
ST_IsValid — Tests if a Geometry is well formed.
ST_IsValidReason — Returns the reason why a geometry is not valid.
ST_M — Returns the M coordinate of a Point
ST_NRings — Returns the number of rings of a Polygon or a MultiPolygon.
ST_NumGeometries — Returns the number of geometries in a GeometryCollection.
ST_NumInteriorRing — Returns the number of interior rings in a Polygon or a MultiPolygon.
ST_NumPoints — Returns the number of Points in a LineString
ST_PointN — Returns the specified point N in a Linestring.
ST_SRID — Returns the Spatial Reference System ID for a geometric object
ST_StartPoint — Returns the start point of a LineString.
ST_Summary — Returns a summary of a Geometry object characteristics.
ST_X — Returns the x coordinate of a point
ST_Y — Returns the y coordinate of a point
ST_Z — Returns the z coordinate of a point
ST_ZmFlag — Returns a code that represents the number of coordinated dimensions of a Geometry.
ST_Last — Returns the last geometry of a set of geometries.
ST_RepeatedPoints — Checks if a geometry has repeated vertices. If any, returns a MultiPoint geometry composed by the points that are duplicated.
4. Geometry Editors
ST_AddPoint — Adds a Point to a LineString before point N.
ST_Affine — Applies a 2D or 3D affine transformacion to a geometry. That means a rotation, scale and translate in a single step.
ST_CollectionExtract — Extracts a particular type of geometry from a collection and converts them to MULTI*. The values for the type of geometry are 1=Point, 2=Line, 3=Polygon.
ST_Extract — Extracts a particular type of geometry from a collection and converts them to MULTI*. The values for the type of geometry are 0=Point, 1=Line, 2=Polygon.
ST_Force_2D — Forces the incoming geometry to be 2D, so it will only have X,Y coordinates.
ST_Force_3D — Forces the incoming geometry to be 3D, so it will have X,Y,Z coordinates.
ST_Force_3DM — Forces the incoming geometry to be 3D, with X,Y and M coordinates.
ST_Force_4D — Forces the incoming geometries to be XYZM dimensions.
ST_Force_Collection — Forces the geometry to be a GEOMETRYCOLLECTION.
ST_ForceRHR — Forces the exterior ring's vertices of a Polygon to follow right hand orientation.
ST_LineMerge — Returns a LineString as a result of merging a MultiLineString.
ST_Multi — Forces a geometry to be MULTI* type. Geometries already Multi, remain unchanged.
ST_RemovePoint — Removes N th Point from a LineString. N index starts at 0.
ST_Reverse — Returns the geometry with the vertex order reversed.
ST_RotateX — Rotates a geometry, an Angle (in radians), around the X axis.
ST_RotateY — Rotates a geometry, an Angle (in radians), around the Y axis.
ST_RotateZ — Rotates a geometry, an Angle (in radians), around the Z axis.
ST_Scale — Scales the geometry to a new size by multiplying the coordinates by the factor of scale of the axis.
ST_Segmentize — Splits a segment of a geometry if it is shorter than a given maximum Length. The distance is computed only in 2D.
ST_SetPoint — Replaces the Nth Point of a Geometry for a new Point. N index starts at 0.
ST_SetSRID — Sets the Spatial Reference ID for a geometry,
ST_SnapToGrid — Snaps a geometry to a grid defined by its cell size and origin.
ST_Transform — Returns a Geometry transformed to the specified spatial reference system.
ST_Translate — Translates a geometry a certain offset along the axis X,Y,Z
ST_TransScale — Translates a geometry, and then scales it.
ST_NodeLine — Returns a Line split at self intersection points, by adding nodes there.
ST_CleanPolygon — Cleans polygons o multipolygons to be topologically corrects. So, enforces them to be valid geometries.
ST_Snap — Snaps the vertices and segments of a Geometry to another Geometry's vertices. A snapping distance tolerance is used to control where snapping is performed.
5. Geometry Outputs
ST_AsBinary — Returns the well-known binary (WKB) representation of a Geometry object.
ST_AsEWKB — Returns the Extended Well-Known Binary (EWKB) representation of a Geometry object.
ST_AsEWKT — Returns the Extended Well-Known Text representation (EWKT) from a geometry object.
ST_AsHEXEWKB — Returns the Extended Well-Known Binary (EWKB) representation, in hexadecimal, of a Geometry object.
ST_AsGML — Returns the Geography Markup Language (GML) representation of a Geometry object.
ST_AsKML — Returns the Keyhole Markup Language (KML) representation of a Geometry object.
ST_AsText — Returns the Well-known Text Representation of a geometric object
6. Spatial Relationships and Measurements
ST_Area — Returns the area of a Polygon or a MultiPolygon.
ST_Azimuth — Returns the azimuth between two points.
ST_Centroid — Returns a point, which is the centroid (geometric center) of a geometry, which may lie outside the geometry
ST_Contains — Tests if a Geometry A spatially contains another Geometry B.
ST_ContainsProperly — Tests if a Geometry A spatially contains properly another Geometry B.
ST_Covers — Tests if a Geometry A spatially covers another Geometry B.
ST_CoveredBy — Tests if a Geometry A is covered by Geometry B.
ST_Crosses — Tests if a Geometry A crosses a Geometry B, returns True if so.
ST_Disjoint — Tests if a Geometry is spatially disjoint from another Geometry.
ST_Distance — Returns the shortest distance between two geometries.
ST_HausdorffDistance — Returns an approximation to the Hausdorff distance between two geometries. It offers a measure of dissimilarity between the geometries.
ST_Distance_Sphere — Returns distance between 2 lat/long points. It is the great-circle distance, also known as or orthodromic, which is the shortest distance between any two points on the surface of a sphere measured along a path on the surface of the sphere
ST_Distance_Spheroid — Returns the shortest distance between 2 lat/long points, using a particular spheroid
ST_DWithin — Tests if two geometries are within a specified distance. Returns True if so, otherwise returns False.
ST_Equals — Tests if a Geometry is spatially equal to another Geometry, returns True if so.
ST_Intersects — Tests if a Geometry spatially intersects another Geometry.
ST_Length — Returns the 2-dimensional length of a Geometry.
ST_Length3D — Returns the 3-dimensional length of a Geometry.
ST_Length_Spheroid — Calculates the 2D or 3D length of a Line represented by its latitude/longitude coordinates.
ST_Length2D_Spheroid — Calculates the 2D length of a Line represented by its latitude/longitude coordinates.
ST_Length3D_Spheroid — Calculates the 3D length of a Line represented by its latitude/longitude coordinates.
ST_OrderingEquals — Tests if two Geometries are equal, and the coordinates are in the same order.
ST_Overlaps — Tests if a Geometry spatially overlaps another Geometry.
ST_Perimeter — Returns the length measurement of the boundary of a Polygon or a MultiPolygon.
ST_PointOnSurface — Returns a Point guaranteed to lie on the geometry
ST_Relate1st Version tests if a Geometry is spatially related to another Geometry as specified by a intersection pattern matrix. 2nd Version returns the DE-9IM (Dimensionally Extended 9 Intersection Model) for two geometries.
ST_Touches — Tests if a Geometry spatially touches another Geometry.
ST_Within — Tests if a Geometry is spatially within another Geometry.
ST_MultiCentroid — Returns a centroid for each part of a complex geometry.
ST_PointOnBoundary — Returns a Point guaranteed to lie on the geometry's boundary.
7. Geometry Processing Functions
ST_Buffer — Returns a geometry that represents all points whose distance from this Geometry is less than or equal to distance. Calculations are in the Spatial Reference System of that Geometry.
ST_BuildArea — Creates a surface geometry from the lines of the input geometries.
ST_Collect — Returns a geometry from the collection of others geometries.
ST_ConvexHull — Returns a geometry that represents the convex hull of the given Geometry.
ST_Difference — Returns a geometry that represents the point set difference of a Geometry with another Geometry.
ST_Dump — Splits Multi-geometries and GeometryCollections into a set of single geometries.
ST_DumpPoints — Returns the set of points that compose a Geometry.
ST_DumpRings — Returns a set of geometry rows, representing the exterior and interior rings of a Polygon or a MultiPolygon.
ST_Intersection — Returns a 2D geometric object that represents the intersection of two geometric objects.
ST_MemUnion — Same as ST_Union (aggregate) but memory-friendly (uses less memory and more processor time).
ST_MinimumBoundingCircle — Returns the minimum circle polygon that can fully contain a geometry.
ST_Polygonize — Creates a GeometryCollection made up of Polygons from a set of Geometries which contain lines that represents the Polygons edges.
ST_Shift_Longitude — Converts geometry longitude values from range [-180,180] to the range [0-360]
ST_Simplify — Simplifies a Geometry using the standard Douglas-Peucker algorithm.
ST_SimplifyPreserveTopology — Simplifies a geometry, ensuring that the result is a valid geometry having the same dimension and number of components as the incoming geometries.
ST_SymDifference — Returns a Geometry object that represents the point set symmetric difference of two Geometry objects.
ST_Union — Returns a Geometry object that represents the point set union of two Geometries.
ST_DelaunayTriangles — Returns polygons that represent Delaunay Trianglulations from collections of points.
ST_SelfIntersection — Returns the points where a Line intersects itself.
8. Linear Referencing
ST_Line_Interpolate_Point — Returns the Coordinates for the point on the line at the given fraction. This fraction, is applied to the line's total length.
ST_Line_Locate_Point — Computes de fraction of a Line from the closest point on the line to the given point.
ST_Line_Substring — Returns a LineString being a portion of the input one. It will start and end at the given fractions of the total 2D length.
ST_Locate_Along_Measure — Extracts Points from a Geometry object that have the specified m coordinate value.
ST_Locate_Between_Measures — Returns a derived geometry whose measures are in the specified M range.
ST_Locate_Along_Elevation — Extracts Points from a Geometry object that have the specified z coordinate value.
ST_Locate_Between_Elevations — Returns a derived geometry whose elevation are in the specified Z range.
ST_Project_Point — Finds the closest point from a Line to a given point
9. Miscellaneous Functions
ST_Accum — Constructs an array of geometries from a set of geometries.
ST_Box2D — Returns a Polygon geometry representation of the two-dimensional bounding box.
ST_Box3D — Returns a Polygon geometry representation of the three-dimensional bounding box
ST_Expand — Expands the Polygon that represents the Bounding Box in all directions.
ST_Extent — Returns the minimum bounding box of the specified geometries, that is, a single rectangle that minimally encloses the geometries.
ST_Extent3D — Returns the minimum bounding box of the specified geometries.
Find_SRID — Returns the SRID of the specified geometry column by searching through the metadata GEOMETRY_COLUMNS table.
ST_Mem_Size — Returns the amount of space (in bytes) the geometry takes.
ST_Point_Inside_Circle — Tests if a point is inside a circle defined by its center coordinates and radius.
ST_XMax — Returns the maximum X of the geometry bounding box.
ST_XMin — Returns the minimum X of the geometry bounding box.
ST_YMax — Returns the maximum Y of the geometry bounding box.
ST_YMin — Returns the minimum Y of the geometry bounding box.
ST_ZMax — Returns the maximum Z of the geometry bounding box.
ST_ZMin — Returns the minimum Z of the geometry bounding box.
ST_Box — Returns a Polygon geometry representation of the 2D or 3D bounding box
ST_AsWKTSRS — Returns the Well-known Text representation of the Spatial Reference System.
MinPair — It takes as input parameter an array of two double values, and returns the minimum second value of the array.
MaxPair — It takes as input parameter an array of two double values, and returns the maximum second value of the array.
10. Functions Clarification
1. ST_Collect, ST_Force_Collection, ST_MakeGeomColl
2. ST_Expand for indexable queries
3. ST_Dump, ST_DumpRings, ST_DumpPoints
3.1. PostgreSQL
3.2. H2
A. Jaspa Versions
1. Jaspa 0.2.0
2. Jaspa 0.1 RC1

List of Figures

3.1. jaspa4h2 folder
3.2. A new variable in the System Path
3.3. Connection to H2 Web Client
3.4. H2 Web Client
3.5. Connection to H2 Web Client
3.6. H2 Web Client
3.7. jaspa4pg folder
3.8. A new variable in the System Path
3.9. Adding a classpath variable in Eclipse
3.10. Maven Integration for Eclipse Plugin
3.11. Maven Project Selection pom.xml
5.1. Geometry Type Hierarchy Diagram
8.1. H2 server. Connection parameters

List of Tables

4.1. OGC SFS Standards
4.2. Spatial Standards Support
5.1. Geometry Subtypes
5.2. Interior, Boundary and Exterior
5.3. DE-9IM
5.4. Spatial Relationships Functions
5.5. DE-9IM matrix example
5.6. GEOMETRY_COLUMNS table
5.7. SPATIAL_REF_SYS view
5.8. Functions using spatial indexes
5.9. Spatial operators
8.1. Tutorial data