PostGIS的GIS功能相比MySQL强大太多,本文仅仅列举了MySQL支持的部分。
欲了解PostGIS请参考:
http://postgis.net/docs/manual-2.2/reference.html
PostGIS有几百个操作函数, 对GIS支持强大。
POINT
MySQL
POINT
PointFromText('POINT(10 10)')
PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))
PostgreSQL
# PostgreSQL
point
point( x , y )
# PostGIS
point
LINESTRING
MySQL
LINESTRING
CREATE TABLE gis_line (g LINESTRING);
SHOW FIELDS FROM gis_line;
INSERT INTO gis_line VALUES
(LineFromText('LINESTRING(0 0,0 10,10 0)')),
(LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
(LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
GLENGTH
Length of a LineString value
ST_ENDPOINT
Returns the endpoint of a LineString
ST_NUMPOINTS
Returns the number of Point objects in a LineString
ST_POINTN
Returns the N-th Point in the LineString
ST_STARTPOINT
Returns the start point of a LineString
PostgreSQL
# PostGIS
LINESTRING
ST_Length — Returns the 2D length of the geometry if it is a LineString or MultiLineString. geometry are in units of spatial reference and geography are in meters (default spheroid)
ST_Length2D — Returns the 2-dimensional length of the geometry if it is a linestring or multi-linestring. This is an alias for ST_Length
ST_3DLength — Returns the 3-dimensional or 2-dimensional length of the geometry if it is a linestring or multi-linestring.
ST_LengthSpheroid — Calculates the 2D or 3D length of a linestring/multilinestring on an el