33. SQL/MM
• The SQL/MM ST_Dimension, ST_GeometryType,
ST_AsText, ST_AsBinary, ST_SRID, ST_IsEmpty,
ST_IsSimple, ST_Boundary, and ST_Envelop, SQL/MM
ST_Equals, ST_Disjoint, ST_Intersects, ST_Touches,
ST_Crosses, ST_Within, ST_Contains, ST_Overlaps and
ST_Relate
– routines shall be supported to test named spatial relationships
between two geometric objects.
• The SQL/MM ST_Distance
– supported to calculate the distance between two geometric objects.
• ST_Intersection, ST_Difference, ST_Union,
ST_SymDifference, ST_Buffer, and ST_ConvexHull
ผศ.ดร.ไพศาล สันติธรรมนนท 33
37. GeomFromText(wkt[,srid]), or
GeometryFromText(wkt[,srid])
• GeomCollFromText(wkt[,srid]), or GeometryCollectionFromText(wkt[,srid])
• PointFromText(wkt[,srid])
• LineFromText(wkt[,srid]), or LineStringFromText(wkt[,srid])
• MLineFromText(wkt[,srid]), or MultiLineStringFromText(wkt[,srid])
• MPointFromText(wkt[,srid]), or MultiPointFromText(wkt[,srid])
• MPolyFromText(wkt[,srid]), or MultiPolygonFromText(wkt[,srid])
• PolyFromText(wkt[,srid]), or PolygonFromText(wkt[,srid])
ผศ.ดร.ไพศาล สันติธรรมนนท 37
38. ฟงกชัน วัตถุเรขาคณิต ทั่วไป
• Dimension(geom)
– The result can be –1, 0, 1, or 2. The meaning of these values is given in Section 2.2
• Envelope(geom)
– Returns the Minimum Bounding Rectangle (MBR) for the geometry value geom.
• GeometryType(geom)
– Returns as a string the name of the geometry type of which the geometry instance
geom is a member.
• IsEmpty(geom)
Returns 1 if the geometry value geom is the empty geometry, 0 if it is not empty, or
NULL if the argument is not a geometry.
• IsSimple(geom)
Returns 1 ไมมีสิ่งผิดปรกติ เชน เสนตัดกันเอง เสนชิดกัน
Returns 0 if the argument is not simple,
Retruns NULL if the argument is not a geometry.
• SRID(geom)
Spatial Reference System ID ชนิดการฉายแผนที่และพื้นหลักฐาน
ผศ.ดร.ไพศาล สันติธรรมนนท 38
39. ฟงกชันแปลงรหัส BLOB WKT/WKB
• AsBinary(geom)
Converts a value in internal BLOB
geometry format to its WKB representation
and returns the binary result.
• AsText(geom)
Converts a value in internal BLOB
geometry format to its WKT representation
and returns the string result.
ผศ.ดร.ไพศาล สันติธรรมนนท 39
59. การเชื่อมตอตาราง SF กับ Attribute ภายนอก
• ขอมูล SF สําหรับแปลงที่ดิน the_geom จัดเก็บอยูในตาราง
“parcel” พรอมเลขแปลงที่ดิน attribute “id”
• แตละแปลงที่ดินมีขอมูลเพิ่มเติมปรากฏในตาราง “owner” และมีเลข
แปลงที่ดิน “id” กํากับเชนกัน
• การเชื่อมตอใช LEFT JOIN โดยการสรางตารางใหม parceljoin
ขึ้นมา ตารางใหมมีคอลัมนชื่อ id, ownername, the_geom
CREATE TABLE parceljoin AS ( SELECT parcel.id as id,
owner.ownername as ownername, parcel.the_geom as
the_geom FROM parcel LEFT JOIN owners ON owner.id
= parcel.id )
ผศ.ดร.ไพศาล สันติธรรมนนท 59
60. การเชื่ อ มต อ UMN MapServer
(mapfile)
• …. รายละเอี ย ดอื่ นๆ …รวมทั้ ง OWS/WMS/WFS
• LAYER
• CONNECTIONTYPE postgis
• NAME quot;widehighwaysquot;
• # Connect to a remote spatial database
• CONNECTION quot;user=dbuser dbname=gisdatabase host=bigserverquot;
• # Get the lines from the ’geom’ column of the ’roads’ table
• DATA quot;geom from roadsquot;
• STATUS ON
• TYPE LINE
• CLASS
• COLOR 0 0 0
• END
• END
ผศ.ดร.ไพศาล สันติธรรมนนท
• … ยั ง มีต อ …..
60