Вы находитесь на странице: 1из 14

SpatiaLite SQL functions reference list

http://www.gaia-gis.it/spatialite/spatialite-sql-2.3.1.html

SQL Version Info functions


Function spatialite_version proj4_version geos_version Syntax spatialite_version( void ) : String proj4_version( void ) : String geos_version( void ) : String Summary returns the current SpatiaLite version as a text string returns the current PROJ.4 version as a text string or NULL if PROJ.4 is currently unsupported returns the current GEOS version as a text string or NULL if GEOS is currently unsupported

SQL math functions


Function Abs Acos Asin Atan Syntax Abs( x Double precision ) : Double precision Acos( x Double precision ) : Double precision Asin( x Double precision ) : Double precision Atan( x Double precision ) : Double precision Ceil( x Double precision ) : Double precision returns the smallest integer value not less than x Ceiling( x Double precision ) : Double precision Cos( x Double precision ) : Double precision Cot( x Double precision ) : Double precision returns the cosine of x, where x is given in radians returns the cotangent of x, where x is given in radians returns the absolute value of x returns the arc cosine of x, that is, the value whose cosine is x returns NULL if x is not in the range -1 to 1 returns the arc sine of x, that is, the value whose sine is x returns NULL if x is not in the range -1 to 1 returns the arc tangent of x, that is, the value whose tangent is x Summary

Ceil Ceiling

Cos Cot Degrees

Degrees( x Double precision ) : returns the argument x, converted from radians to degrees Double precision Exp( x Double precision ) : Double precision Floor( x Double precision ) : Double precision Ln( x Double precision ) : Double precision Log( x Double precision ) : Double precision Log( b Double precision , x Double precision ) : Double precision returns the value of e (the base of natural logarithms) raised to the power of x the inverse of this function is Log() (using a single argument only) or Ln() returns the largest integer value not greater than x

Exp

Floor

Ln Log

returns the natural logarithm of x; that is, the base-e logarithm of x If x is less than or equal to 0, then NULL is returned

Log

returns the logarithm of x to the base b If x is less than or equal to 0, or if b is less than or equal to 1, then NULL is returned Log(b, x) is equivalent to Log(x) / Log(b)

Log2

Log2( x Double precision ) : Double precision Log10( x Double precision ) : Double precision PI( void ) : Double precision Pow( x Double precision , y Double precision ) : Double precision

returns the base-2 logarithm of x Log2(x) is equivalent to Log(x) / Log(2) returns the base-10 logarithm of x Log10(x) is equivalent to Log(x) / Log(10) returns the value of PI

Log10 PI

Pow Power

returns the value of x raised to the power of y Power( x Double precision , y Double precision ) : Double precision Radians( x Double precision ) : returns the argument x, converted from degrees to radians Double precision Round( x Double precision ) : Double precision returns the integer value nearest to x

Radians Round

1 von 14

29.08.2011 12:38

SpatiaLite SQL functions reference list


Double precision Sign Sin Sqrt Stddev_pop Stddev_samp Tan Sign( x Double precision ) : Double precision Sin( x Double precision ) : Double precision Sqrt( x Double precision ) : Double precision

http://www.gaia-gis.it/spatialite/spatialite-sql-2.3.1.html

returns the sign of the argument as -1, 0, or 1, depending on whether x is negative, zero, or positive. returns the sine of x, where x is given in radians returns the square root of a non-negative number x

Stddev_pop( x Double precision returns the population standard deviation of the input values ) : Double precision aggregate function Stddev_samp( x Double precision ) : Double precision Tan( x Double precision ) : Double precision returns the sample standard deviation of the input values aggregate function returns the tangent of x, where x is given in radians

Var_pop

returns the population variance of the input values (square of the population Var_pop( x Double precision ) : standard deviation) Double precision aggregate function returns the sample variance of the input values (square of the sample standard Var_samp( x Double precision ) deviation) : Double precision aggregate function

Var_samp

SQL utility functions for BLOB objects


Function Syntax Summary The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL or not-BLOB argument. TRUE if this BLOB object corresponds to a valid ZIP-compressed file The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL or not-BLOB argument. TRUE if this BLOB object corresponds to a valid PDF document The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL or not-BLOB argument. TRUE if this BLOB object corresponds to a valid GIF image The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL or not-BLOB argument. TRUE if this BLOB object corresponds to a valid PNG image The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL or not-BLOB argument. TRUE if this BLOB object corresponds to a valid TIFF image The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL or IsWaveletBlob( image BLOB ) : not-BLOB argument. Integer TRUE if this BLOB object corresponds to a valid WAVELET image The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL or not-BLOB argument. TRUE if this BLOB object corresponds to a valid JPEG image The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL or not-BLOB argument. TRUE if this BLOB object corresponds to a valid EXIF image Please note: any valid EXIF image is a valid JPEG as well The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL or IsExifGpsBlob( image BLOB ) : not-BLOB argument. Integer

IsZipBlob

IsZipBlob( content BLOB ) : Integer

IsPdfBlob

IsPdfBlob( content BLOB ) : Integer

IsGifBlob

IsGifBlob( image BLOB ) : Integer

IsPngBlob

IsPngBlob( image BLOB ) : Integer

IsTiffBlob

IsTiffBlob( image BLOB ) : Integer

IsWaveletBlob

IsJpegBlob

IsJpegBlob( image BLOB ) : Integer

IsExifBlob

IsExifBlob( image BLOB ) : Integer

IsExifGpsBlob

2 von 14

29.08.2011 12:38

SpatiaLite SQL functions reference list


IsExifGpsBlob

http://www.gaia-gis.it/spatialite/spatialite-sql-2.3.1.html

Integer TRUE if this BLOB object corresponds to a valid EXIF-GPS image Please note: any valid EXIF-GPS image is a valid EXIF and JPEG as well

SQL utility functions [non-standard] for geometric objects


Function Syntax OpenGis SpatiaLite PROJ GEOS defined base included included Summary a POINT Geometry will be returned representing the GPS long/lat contained within EXIF-GPS metadata for the BLOB image NULL will be returned if for any reason it's not possible to build such a POINT MakePoint MakePoint( x Double precision , y Double precision , [ , SRID Integer] ) : Geometry BuildMbr( x1 Double precision , y1 Double precision , x2 Double precision , y2 Double precision [ , SRID Integer] ) : Geometry BuildCircleMbr( x Double precision , y Double precision , radius Double precision [ , SRID Integer] ) : Geometry MbrMinX( geom Geometry) : Double precision MbrMinY( geom Geometry) : Double precision MbrMaxX( geom Geometry) : Double precision MbrMaxY( geom Geometry) : Double precision X X X a Geometry will be returned representing the POINT defined by [x y] coordinates [x1 y1] and [x2 y2] are assumed to be Points identifying a line segment; then a Geometry will be returned representing the MBR for this line segment [x y] is assumed to be the center of a circle of given radius; then a Geometry will be returned representing the MBR for this circle return the x-coordinate for geom MBR's leftmost side as a double precision number return the y-coordinate for geom MBR's lowermost side as a double precision number return the x-coordinate for geom MBR's rightmost side as a double precision number return the y-coordinate for geom MBR's uppermost side as a double precision number

GeomFromExifGpsBlob

GeomFromExifGpsBlob( image BLOB ) : Geometry

BuildMbr

BuildCircleMbr

MbrMinX

MbrMinY

MbrMaxX

MbrMaxY

SQL functions for constructing a geometric object given its Well-known Text Representation
Function GeomFromText PointFromText Syntax GeomFromText( wkt String [ , SRID Integer] ) : Geometry PointFromText( wktPoint String [ , SRID Integer] ) : Point LineFromText( wktLineString String [ , SRID Integer] ) : Linestring X LineStringFromText( wktLineString String [ , SRID Integer] ) : Linestring PolyFromText( wktPolygon String [ , SRID Integer] ) : Polygon X PolygonFromText( wktPolygon String [ , SRID Integer] ) : Polygon MPointFromText( wktMultiPoint String [ , SRID Integer] ) : MultiPoint X MultiPointFromText( X X X construct a MultiPoint X X X construct a Polygon X X X construct a Linestring OpenGis SpatiaLite PROJ GEOS defined base included included X X X X X X X X Summary construct a geometric object given its Well-known text Representation construct a Point

LineFromText LineStringFromText

PolyFromText PolygonFromText

MPointFromText MultiPointFromText

3 von 14

29.08.2011 12:38

SpatiaLite SQL functions reference list


MultiPointFromText( wktMultiPoint String [ , SRID Integer] ) : MultiPoint MLineFromText( wktMultiLineString String [ , SRID Integer] ) : MultiLinestring X MultiLineStringFromText( wktMultiLineString String [ , SRID Integer] ) : MultiLinestring MPolyFromText( wktMultiPolygon String [ , SRID Integer] ) : MultiPolygon X MultiPolygonFromText( wktMultiPolygon String [ , SRID Integer] ) : MultiPolygon GeomCollFromText( wktGeometryCollection String [ , SRID Integer] ) : GeometryCollection X GeometryCollectionFromText( wktGeometryCollection String [ , SRID Integer] ) : GeometryCollection X X X

http://www.gaia-gis.it/spatialite/spatialite-sql-2.3.1.html

MLineFromText MultiLineStringFromText

construct a MultiLinestring

MPolyFromText MultiPolygonFromText

construct a MultiPolygon

GeomCollFromText GeometryCollectionFromText

construct a GeometryCollection

SQL functions for constructing a geometric object given its Well-known Binary Representation
Function Syntax GeomFromWKB( wkbGeometry Binary [ , SRID Integer] ) : Geometry PointFromWKB( wkbPoint Binary [ , SRID Integer] ) : Point LineFromWKB( wkbLineString Binary [ , SRID Integer] ) : Linestring X LineStringFromText( wkbLineString Binary [ , SRID Integer] ) : Linestring PolyFromWKB( wkbPolygon Binary [ , SRID Integer] ) : Polygon X PolygonFromWKB( wkbPolygon Binary [ , SRID Integer] ) : Polygon MPointFromWKB( wkbMultiPoint Binary [ , SRID Integer] ) : MultiPoint X MultiPointFromWKB( wkbMultiPoint Binary [ , SRID Integer] ) : MultiPoint MLineFromWKB( wkbMultiLineString Binary [ , SRID Integer] ) : MultiLinestring X MultiLineStringFromWKB( wkbMultiLineString Binary [ , SRID Integer] ) : MultiLinestring MPolyFromWKB( X X X construct a MultiLinestring X X X construct a MultiPoint X X X construct a Polygon X X X construct a Linestring OpenGis SpatiaLite PROJ GEOS defined base included included X X X X Summary construct a geometric object given its Well-known binary Representation construct a Point

GeomFromWKB

PointFromWKB

LineFromWKB LineStringFromWKB

PolyFromWKB PolygonFromWKB

MPointFromWKB MultiPointFromWKB

MLineFromWKB MultiLineStringFromWKB

4 von 14

29.08.2011 12:38

SpatiaLite SQL functions reference list


MPolyFromWKB( wkbMultiPolygon Binary [ , SRID Integer] ) : MultiPolygon X MultiPolygonFromWKB( wkbMultiPolygon Binary [ , SRID Integer] ) : MultiPolygon GeomCollFromWKB( wkbGeometryCollection Binary [ , SRID Integer] ) : GeometryCollection X GeometryCollectionFromWKB( wkbGeometryCollection Binary [ , SRID Integer] ) : GeometryCollection X X

http://www.gaia-gis.it/spatialite/spatialite-sql-2.3.1.html

MPolyFromWKB MultiPolygonFromWKB

construct a MultiPolygon

GeomCollFromWKB GeometryCollectionFromWKB

construct a GeometryCollection

SQL functions for obtaining the Well-known Text / Well-known Binary Representation of a geometric object
Function AsText AsBinary Syntax AsText( geom Geometry ) : String AsBinary( geom Geometry ) : Binary OpenGis SpatiaLite PROJ GEOS defined base included included X X X X X X X X Summary returns the Well-known Text representation returns the Well-known Binary representation

SQL functions supporting exotic geometric formats


Function Syntax AsSVG( geom Geometry [ , relative Integer [ , precision Integer ] ] ) : String AsFGF( geom Geometry ) : Binary GeomFromFGF( fgfGeometry Binary [ , SRID Integer] ) : Geometry OpenGis SpatiaLite PROJ GEOS defined base included included X X X Summary returns the SVG [Scalable Vector Graphics] representation returns the FGF [FDO Geometry Binary Format] representation construct a geometric object given its FGF binary Representation

AsSVG

AsFGF

GeomFromFGF

SQL functions on type Geometry


Function Syntax OpenGis SpatiaLite PROJ GEOS defined base included included Summary returns the dimension of the geometric object, which is less than or equal to the dimension of the coordinate space returns the name of the instantiable subtype of Geometry of which this geometric object is a member, as a string returns the Spatial Reference System ID for this geometric object directly sets the Spatial Reference System ID for this geometric object [no reprojection is applied] SetSRID SetSRID( geom Geometry , SRID Integer ) : Integer X X X The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments. The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments. TRUE if this geometric object corresponds to the empty set

Dimension

Dimension( geom Geometry ) : Integer

GeometryType

GeometryType( geom Geometry ) : String SRID( geom Geometry ) : Integer

SRID

IsEmpty

IsEmpty( geom Geometry ) : Integer

5 von 14

29.08.2011 12:38

SpatiaLite SQL functions reference list

http://www.gaia-gis.it/spatialite/spatialite-sql-2.3.1.html
corresponds to the empty set The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments. TRUE if this geometric object is simple, as defined in the Geometry Model The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments. TRUE if this geometric object does not contains any topological error

IsSimple

IsSimple( geom Geometry ) : Integer

IsValid

IsValid( geom Geometry ) : Integer

Boundary

Boundary( geom Geometry ) : Geometry

returns a geometric object that is the combinatorial boundary of g as defined in the Geometry Model returns the rectangle bounding g as a Polygon. The Polygon is defined by the corner points of the bounding box [(MINX, MINY),(MAXX, MINY), (MAXX, MAXY), (MINX, MAXY), (MINX, MINY)].

Envelope

Envelope( geom Geometry ) : Geometry

SQL functions on type Point


Function X Y Syntax X( pt Point ) : Double precision T( pt Point ) : Double precision OpenGis SpatiaLite PROJ GEOS defined base included included X X X X X X X X Summary return the x-coordinate of Point p as a double precision number return the y-coordinate of Point p as a double precision number

SQL functions on type Curve [Linestring or Ring]


Function StartPoint EndPoint Syntax StartPoint( c Curve ) : Point EndPoint( c Curve ) : Point GLength( c Curve ) : Double precision OpenGis name for this function is Length(), but it conflicts with an SQLite reserved keyword OpenGis SpatiaLite PROJ GEOS defined base included included X X X X X X X X Summary return a Point containing the first Point of c return a Point containing the last Point of c

GLength

return the length of c

IsClosed

IsClosed( c Curve ) : Integer

The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments; return TRUE if c is closed, i.e., if StartPoint(c) = EndPoint(c) The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments. return TRUE if c is a ring, i.e., if c is closed and simple. A simple Curve does not pass through the same Point more than once.

IsRing

IsRing( c Curve ) : Integer

6 von 14

29.08.2011 12:38

SpatiaLite SQL functions reference list

http://www.gaia-gis.it/spatialite/spatialite-sql-2.3.1.html
same Point more than once. Simplify( c Curve , tolerance Double precision ) : Curve return a geometric object representing a simplified version of c applying the Douglas-Peukert algorithm with given tolerance return a geometric object representing a simplified version of c applying the Douglas-Peukert algorithm with given tolerance and respecting topology

Simplify

SimplifyPreserveTopology

SimplifyPreserveTopology( c Curve , tolerance Double precision ) : Curve

SQL functions on type LineString


Function NumPoints PointN Syntax NumPoints( line LineString ) : Integer PointN( line LineString , n Integer ) : Point OpenGis SpatiaLite PROJ GEOS defined base included included X X X X X X X X Summary return the number of Points in the LineString return a Point containing Point n of line

SQL functions on type Surface [Polygon or Ring]


Function Centroid PointOnSurface Area Syntax Centroid( s Surface ) : Point PointOnSurface( s Surface ) : Point Area( s Surface ) : Double precision OpenGis SpatiaLite PROJ GEOS defined base included included X X X X X X Summary return the centroid of s, which may lie outside s return a Point guaranteed to lie on the Surface return the area of s

SQL functions on type Polygon


Function ExteriorRing Syntax ExteriorRing( polyg Polygon ) : LineString NumInteriorRing( polyg Polygon ) : Integer X NumInteriorRings( polyg Polygon ) : Integer InteriorRingN( polyg Polygon , n Integer ) : LineString X X X X return the nth interiorRing. The order of Rings is not geometrically significant. X X X return the number of interiorRings OpenGis SpatiaLite PROJ GEOS defined base included included X X X X Summary return the exteriorRing of p

NumInteriorRing NumInteriorRings

InteriorRingN

SQL functions on type GeomCollection


Function NumGeometries Syntax NumGeometries( geom GeomCollection ) : Integer GeometryN( geom GeomCollection , n Integer ) : Geometry OpenGis SpatiaLite PROJ GEOS defined base included included X X X X Summary return the number of interiorRings return the nth geometric object in the collection. The order of the elements in the collection is not geometrically significant.

GeometryN

SQL functions that test approximative spatial relationships via MBRs


Function Syntax OpenGis SpatiaLite PROJ GEOS defined base included included Summary The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments. TRUE if g1 and g2 have equal MBRs

MbrEqual

MbrEqual( geom1 Geometry , geom2 Geometry ) : Integer

7 von 14

29.08.2011 12:38

SpatiaLite SQL functions reference list

http://www.gaia-gis.it/spatialite/spatialite-sql-2.3.1.html
MBRs The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments. TRUE if the intersection of g1 and g2 MBRs is the empty set The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments. TRUE if the only Points in common between g1 and g2 MBRs lie in the union of the boundaries of g1 and g2 The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments. TRUE if g1 MBR is completely contained in g2 MBR The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments. TRUE if the intersection of g1 and g2 MBRs results in a value of the same dimension as g1 and g2 that is different from both g1 and g2 The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments; convenience predicate: TRUE if the intersection of g1 and g2 MBRs is not empty The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments; convenience predicate: TRUE if g2 MBR is completely contained in g1 MBR

MbrDisjoint

MbrDisjoint( geom1 Geometry , geom2 Geometry ) : Integer

MbrTouches

MbrTouches( geom1 Geometry , geom2 Geometry ) : Integer

MbrWithin

MbrWithin( geom1 Geometry , geom2 Geometry ) : Integer

MbrOverlaps

MbrOverlaps( geom1 Geometry , geom2 Geometry ) : Integer

MbrIntersects

MbrIntersects( geom1 Geometry , geom2 Geometry ) : Integer

MbrContains

MbrContains( geom1 Geometry , geom2 Geometry ) : Integer

SQL functions that test spatial relationships


Function Syntax OpenGis SpatiaLite PROJ GEOS defined base included included Summary The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments. TRUE if g1 and g2 are equal The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments.

Equals

Equals( geom1 Geometry , geom2 Geometry ) : Integer

Disjoint

Disjoint( geom1 Geometry , geom2 Geometry ) : Integer

8 von 14

29.08.2011 12:38

SpatiaLite SQL functions reference list


geom2 Geometry ) : Integer

http://www.gaia-gis.it/spatialite/spatialite-sql-2.3.1.html
invocation on NULL arguments. TRUE if the intersection of g1 and g2 is the empty set The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments. TRUE if the only Points in common between g1 and g2 lie in the union of the boundaries of g1 and g2 The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments. TRUE if g1 is completely contained in g2 The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments. TRUE if the intersection of g1 and g2 results in a value of the same dimension as g1 and g2 that is different from both g1 and g2 The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments.

Touches

Touches( geom1 Geometry , geom2 Geometry ) : Integer

Within

Within( geom1 Geometry , geom2 Geometry ) : Integer

Overlaps

Overlaps( geom1 Geometry , geom2 Geometry ) : Integer

Crosses

Crosses( geom1 Geometry , geom2 Geometry ) : Integer

TRUE if the intersection of g1 and g2 results in a value whose dimension is less than the maximum dimension of g1 and g2 and the intersection value includes Points interior to both g1 and g2, and the intersection value is not equal to either g1 or g2 The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments; convenience predicate: TRUE if the intersection of g1 and g2 is not empty The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments; convenience predicate: TRUE if g2 is completely contained in g1 The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments; returns TRUE if the spatial relationship specified by the patternMatrix holds

Intersects

Intersects( geom1 Geometry , geom2 Geometry ) : Integer

Contains

Contains( geom1 Geometry , geom2 Geometry ) : Integer

Relate

Relate( geom1 Geometry , geom2 Geometry , patternMatrix String ) : Integer

9 von 14

29.08.2011 12:38

SpatiaLite SQL functions reference list

http://www.gaia-gis.it/spatialite/spatialite-sql-2.3.1.html

SQL functions for distance relationships


Function Syntax Distance( geom1 Geometry , geom2 Geometry ) : Double precision OpenGis SpatiaLite PROJ GEOS defined base included included X X Summary return the distance between geom1 and geom2

Distance

SQL functions that implement spatial operators


Function Syntax Intersection( geom1 Geometry , geom2 Geometry ) : Geometry Difference( geom1 Geometry , geom2 Geometry ) : Geometry GUnion( geom1 Geometry , geom2 Geometry ) : Geometry OpenGis name for this function is Union(), but it conflicts with an SQLite reserved keyword GUnion( geom Geometry ) : Geometry SymDifference( geom1 Geometry , geom2 Geometry ) : Geometry OpenGis SpatiaLite PROJ GEOS defined base included included X X Summary return a geometric object that is the intersection of geometric objects geom1 and geom2 return a geometric object that is the closure of the set difference of geom1 and geom2

Intersection

Difference

GUnion

return a geometric object that is the set union of geom1 and geom2

GUnion

return a geometric object that is the set union of input values aggregate function return a geometric object that is the closure of the set symmetric difference of geom1 and geom2 (logical XOR of space) return a geometric object defined by buffering a distance d around geom, where dist is in the distance units for the Spatial Reference of geom return a geometric object that is the convex hull of geom

SymDifference

Buffer

Buffer( geom Geometry , dist Double precision ) : Geometry ConvexHull( geom Geometry ) : Geometry

ConvexHull

SQL functions for coordinate transformations


Function Syntax OpenGis SpatiaLite PROJ GEOS defined base included included Summary return a geometric object obtained by reprojecting coordinates into the Reference System identified by newSRID

Transform

Transform( geom Geometry , newSRID Integer ) : Geometry ShiftCoords( geom Geometry , shiftX Double precision , shiftY Double precision ) : Geometry

ShiftCoords ShiftCoordinates

ShiftCoordinates( geom Geometry , shiftX Double precision , shiftY Double precision ) : Geometry ScaleCoords( geom Geometry , scaleX Double precision [ , scaleY Double precision ] ) : Geometry

return a geometric object obtained by translating coordinates according to shiftX and shiftY values

return a geometric object obtained by scaling coordinates according to scaleX and scaleY values if only one scale factor is specified, then an isotropic scaling occurs [i.e. the same scale factor is applied to both axis] otherwise an anisotropic scaling occurs [i.e. each axis is scaled according to its own scale factor]

ScaleCoords ScaleCoordinates

X ScaleCoordinates( geom Geometry , scaleX Double precision [ , scaleY Double precision ] ) : Geometry RotateCoords( geom Geometry , angleInDegrees Double precision ) : Geometry

return a geometric object obtained

10 von 14

29.08.2011 12:38

SpatiaLite SQL functions reference list

http://www.gaia-gis.it/spatialite/spatialite-sql-2.3.1.html

RotateCoords RotateCoordinates

precision ) : Geometry X RotateCoordinates( geom Geometry , angleInDegrees Double precision ) : Geometry ReflectCoords( geom Geometry , xAxis Integer , yAxis Integer ) : Geometry X ReflectCoordinates( geom Geometry , xAxis Integer , yAxis Integer ) : Geometry SwapCoords( geom Geometry ) : Geometry X SwapCoordinates( geom Geometry ) : Geometry X X X X X X

return a geometric object obtained by rotating coordinates according to angleInDegrees value

return a geometric object obtained by reflecting coordinates according to xAxis and yAxis switches i.e. if xAxis is 0 (FALSE), then x-coordinates remains untouched; otherwise x-coordinates will be reflected

ReflectCoords ReflectCoordinates

SwapCoords SwapCoordinates

return a geometric object obtained by swapping x- and y-coordinates

SQL functions for Spatial-MetaData and Spatial-Index handling


Function Syntax OpenGis SpatiaLite PROJ GEOS defined base included included Summary Creates the geometry_columns and spatial_ref_sys metadata tables the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE X X X direct invocation of these function is discouraged; you have to run the init_spatialite.sql script in order to fully initialize the Spatial MetaData tables Creates a new geometry column updating the Spatial Metadata tables and creating any required trigger in order to enforce constraints geom_type has to be one of the followings: 'POINT' 'LINESTRING' 'POLYGON' 'MULTIPOINT' 'MULTILINESTRING' 'MULTIPOLYGON' 'GEOMETRYCOLLECTION' AddGeometryColumn( table String , column String , srid Integer , geom_type String , dimension Integer [ , not_null Integer ] ) : Integer dimension has to be always 2, because current SpatiaLite version only supports 2D the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE the optional 6th arg [not_null] is a non-standard extension required by the peculiar SQLite arch: if set to 0 [false], then the Geometry column will accept NULL values as well. This is the default behaviour if set to any <> 0 value [true], then the Geometry will be defined using a NOT NULL clause Validates an existing ordinary

InitSpatialMetaData

InitSpatialMetaData( void ) : Integer

AddGeometryColumn

11 von 14

29.08.2011 12:38

SpatiaLite SQL functions reference list

http://www.gaia-gis.it/spatialite/spatialite-sql-2.3.1.html
Validates an existing ordinary column in order to possibly transform it in a real geometry column, thus updating the Spatial Metadata tables and creating any required trigger in order to enforce constraints the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE Removes a geometry column from Spatial MetaData tables and drops any related trigger the column itself still continues to exist untouched as an ordinary, unconstrained column the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE Builds an RTree Spatial Index on a geometry column, creating any required trigger required in order to enforce full data coherency between the main table and Spatial Index the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE Builds an MbrCache on a geometry column, creating any required trigger required in order to enforce full data coherency between the main table and the MbrCache the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE Disables an RTree Spatial Index or MbrCache, removing any related trigger X X X the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE

RecoverGeometryColumn

RecoverGeometryColumn( table String , column String , srid Integer , geom_type String , dimension Integer ) : Integer

DiscardGeometryColumn

DiscardGeometryColumn( table String , column String ) : Integer

CreateSpatialIndex

CreateSpatialIndex( table String , column String ) : Integer

CreateMbrCache

CreateMbrCache( table String , column String ) : Integer

DisableSpatialIndex

DisableSpatialIndex( table String , column String ) : Integer

SQL functions implementing FDO/OGR compatibily


Function Syntax OpenGis SpatiaLite PROJ GEOS defined base included included Summary Checks the Spatial Metadata type, then returning: 0 - if geometry_columns and spatial_ref_sys tables does not exists 1 - if both tables exist, and their layout is the one used by SpatiaLite 2 - if both tables exist, and their layout is the one used by FDO/OGR This function will inspect the Spatial Metadata, then automatically creating/refreshing a VirtualFDO wrapper for each FDO/OGR geometry table the return type is Integer [how many VirtualFDO tables have been

CheckSpatialMetaData

CheckSpatialMetaData( void ) : Integer

AutoFDOStart

AutoFDOStart( void ) : Integer

12 von 14

29.08.2011 12:38

SpatiaLite SQL functions reference list

http://www.gaia-gis.it/spatialite/spatialite-sql-2.3.1.html
VirtualFDO tables have been created] This function will inspect the Spatial Metadata, then automatically destroying any VirtualFDO wrapper found the return type is Integer [how many VirtualFDO tables have been destroyed] Creates the geometry_columns and spatial_ref_sys metadata tables the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE Please note: Spatial Metadata created using this function will have the FDO/OGR layout, and not the SpatiaLite's own Creates a new geometry column updating the FDO/OGR Spatial Metadata tables geom_type has to be one of the followings: 1 POINT 2 LINESTRING 3 POLYGON 4 MULTIPOINT 5 MULTILINESTRING 6 MULTIPOLYGON 7 GEOMETRYCOLLECTION dimension may be 2, 3 or 4, accordingly to OGR/FDO specs geometry_format has to be one of the followings: 'WBT' 'WKT' 'FGF' the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE Validates an existing ordinary column in order to possibly transform it in a real geometry column, thus updating the FDO/OGR Spatial Metadata tables the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE Removes a geometry column from FDO/OGR Spatial MetaData tables the column itself still continues to exist untouched as an ordinary column the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE

AutoFDOStop

AutoFDOStop( void ) : Integer

InitFDOSpatialMetaData

InitFDOSpatialMetaData( void ) : Integer

AddFDOGeometryColumn

AddFDOGeometryColumn( table String , column String , srid Integer , geom_type Integer , dimension Integer, geometry_format String ) : Integer

RecoverFDOGeometryColumn( table String , column String , srid Integer , geom_type String RecoverFDOGeometryColumn , dimension Integer, geometry_format String ) : Integer

DiscardFDOGeometryColumn( DiscardFDOGeometryColumn table String , column String ) : Integer

SQL functions for MbrCache-based queries


Function Syntax FilterMbrWithin( x1 Double precision , y1 Double precision OpenGis SpatiaLite PROJ GEOS defined base included included Summary Retrieves from an MbrCache any entity whose MBR falls within the

13 von 14

29.08.2011 12:38

SpatiaLite SQL functions reference list

http://www.gaia-gis.it/spatialite/spatialite-sql-2.3.1.html

FilterMbrWithin

precision , y1 Double precision , x2 Double precision , y2 Double precision ) FilterMbrContains( x1 Double precision , y1 Double precision , x2 Double precision , y2 Double precision ) FilterMbrIntersects( x1 Double precision , y1 Double precision , x2 Double precision , y2 Double precision )

entity whose MBR falls within the rectangle identified by extreme points x1 y1 and x2 y2 Retrieves from an MbrCache any entity whose MBR contains the rectangle identified by extreme points x1 y1 and x2 y2 Retrieves from an MbrCache any entity whose MBR intersects the rectangle identified by extreme points x1 y1 and x2 y2 Creates an MBR identified by extreme points x1 y1 and x2 y2

FilterMbrContains

FilterMbrIntersects

BuildMbrFilter

BuildMbrFilter( x1 Double precision , y1 Double precision , x2 Double precision , y2 Double precision )

This fuction is used internally by triggers related to MbrCache management, and is not intended for any other usage

14 von 14

29.08.2011 12:38

Вам также может понравиться