Tuesday, May 25, 2010

PostGIS Functions

Constructors

ST_MakePoint(Float Longitude, Float Latitude) returns Point

Create a new point. Note the order of the coordinates (longitude then latitude).

ST_GeomFromText(String WellKnownText, Integer SRID) returns Geometry

Create a new geometry from a standard formatted string and SRID. For example: POINT(0 0), LINESTRING(0 0, 1 1), POLYGON((0 0, 0 1, 1 1, 1 0, 0 0)).

ST_SetSRID(Geometry, Integer SRID) returns Geometry

Update the SRID on a geometry. This does not alter the coordinates of the geometry, it just updates the SRID number. For example: ST_SetSRID(‘POINT(0 0)’::geometry, 4326). The direct cast of text to geometry creates a geometry without an SRID, so we set it post-facto. This function is useful for conditioning geometries created without SRIDs.

ST_Expand(Geometry, Float Radius) returns Geometry

Create a new geometry that is the expanded bounding box of the input geometry. For example: ST_Expand(‘POINT(0 0)’, 1) returns POLYGON((-1 -1, -1 1, 1 1, 1 -1, -1 -1)). This function is useful for creating envelopes for use in indexed searches.

Outputs

ST_AsText(Geometry)

Convert geometry from internal format to human-readable text format.

ST_AsGML(Geometry)

Convert geometry from internal format to standard OGC GML format.

ST_AsGeoJSON(Geometry)

Convert geometry from internal format to standard GeoJSON format.

Measurements

ST_Area(Geometry) returns Float

Return the area of the geometry in the units of the spatial reference system.

ST_Length(Geometry) returns Float

Return the length of the geometry in the units of the spatial reference system.

ST_Perimeter(Geometry) returns Float

Return the perimeter of the geometry in the units of the spatial reference system.

ST_NumPoints(Linestring) returns Integer

Return the number of vertices in a linestring.

ST_NumRings(Polygon) returns Integer

Returns the number of rings in a polygon.

ST_NumGeometries(Geometry) returns Integer

Returns the number of geometries in a geometry collection.

Relationships

ST_Distance(Geometry, Geometry) returns Float

Return the distance between two geometries in the units of the spatial reference system.

ST_DWithin(Geometry, Geometry, Float Radius) returns Boolean

Return true if the geometries are within radius distance of one another.

ST_Intersects(Geometry, Geometry) returns Boolean

Return true if the geometries are not disjoint.

ST_Contains(GeometryA, GeometryB) returns Boolean

Return true if geometry “A” fully contains geometry “B”.

ST_Crosses(Geometry, Geometry) returns Boolean

For line/polygon case, return true if line crosses polygon boundary. For line/line case, return true if lines cross.

No comments:

Post a Comment

Pages

About Me

My photo
- A competent M.S. Software Engineer and B.E. (Comp) with 6 years of rich experience in Java/ C / C++ / Oracle/PHP/Postgresql/Mysql in IT industry.
- Resourceful in developing Applications with various platforms and different domains.
A strategic planner with expertise in designing internal control systems towards the accomplishment of corporate business goals.
- A keen analyst with exceptional relationship management skills and abilities in liaising with different clients.
- Team player with excellent analytical and communications skills.
Worked with development projects with software brands like Cognizant and Infosys
Specialties
- Master in struts
- Good hands on in core Java
- Understanding of other building blocks of Enterprise applications like middle ware technologies.
- Knowledge of database like Oracle,postgresql,mysql