Tuesday, May 25, 2010

PostGIS Functions that support 3D

The functions given below are PostGIS functions that do not throw away the Z-Index.

  • AddGeometryColumn – Adds a geometry column to an existing table of attributes.
  • DropGeometryColumn – Removes a geometry column from a spatial table.
  • ST_Accum – Aggregate. Constructs an array of geometries.
  • ST_AddPoint – Adds a point to a LineString before point (0-based index).
  • ST_Affine – Applies a 3d affine transformation to the geometry to do things like translate, rotate, scale in one step.
  • ST_AsEWKB – Return the Well-Known Binary (WKB) representation of the geometry with SRID meta data.
  • ST_AsEWKT – Return the Well-Known Text (WKT) representation of the geometry with SRID meta data.
  • ST_AsGML – Return the geometry as a GML version 2 or 3 element.
  • ST_AsGeoJSON – Return the geometry as a GeoJSON element.
  • ST_AsHEXEWKB – Returns a Geometry in HEXEWKB format (as text) using either little-endian (NDR) or big-endian (XDR) encoding.
  • ST_AsKML – Return the geometry as a KML element. Several variants. Default version=2, default precision=15
  • ST_Boundary – Returns the closure of the combinatorial boundary of this Geometry.
  • ST_Box3D – Returns a BOX3D representing the maximum extents of the geometry.
  • ST_Collect – Return a specified ST_Geometry value from a collection of other geometries.
  • ST_ConvexHull – The convex hull of a geometry represents the minimum convex geometry that encloses all geometries within the set.
  • ST_CoordDim – Return the coordinate dimension of the ST_Geometry value.
  • ST_CurveToLine – Converts a CIRCULARSTRING/CURVEDPOLYGON to a LINESTRING/POLYGON
  • ST_Difference – Returns a geometry that represents that part of geometry A that does not intersect with geometry B.
  • ST_Dump – Returns a set of geometry_dump (geom,path) rows, that make up a geometry g1.
  • ST_DumpRings – Returns a set of geometry_dump rows, representing the exterior and interior rings of a polygon.
  • ST_EndPoint – Returns the last point of a LINESTRING geometry as a POINT.
  • ST_Extent3D – an aggregate function that returns the box3D bounding box that bounds rows of geometries.
  • ST_ExteriorRing – Returns a line string representing the exterior ring of the POLYGON geometry. Return NULL if the geometry is not a polygon. Will not work with MULTIPOLYGON
  • ST_ForceRHR – Forces the orientation of the vertices in a polygon to follow the Right-Hand-Rule.
  • ST_Force_3D – Forces the geometries into XYZ mode. This is an alias for ST_Force_3DZ.
  • ST_Force_3DZ – Forces the geometries into XYZ mode. This is a synonym for ST_Force_3D.
  • ST_Force_4D – Forces the geometries into XYZM mode.
  • ST_Force_Collection – Converts the geometry into a GEOMETRYCOLLECTION.
  • ST_GeomFromEWKB – Return a specified ST_Geometry value from Extended Well-Known Binary representation (EWKB).
  • ST_GeomFromEWKT – Return a specified ST_Geometry value from Extended Well-Known Text representation (EWKT).
  • ST_GeometryN – Return the 1-based Nth geometry if the geometry is a GEOMETRYCOLLECTION, MULTIPOINT, MULTILINESTRING, MULTICURVE or MULTIPOLYGON. Otherwise, return NULL.
  • ST_HasArc – Returns true if a geometry or geometry collection contains a circular string
  • ST_InteriorRingN – Return the Nth interior linestring ring of the polygon geometry. Return NULL if the geometry is not a polygon or the given N is out of range.
  • ST_IsClosed – Returns TRUE if the LINESTRING’s start and end points are coincident.
  • ST_IsSimple – Returns (TRUE) if this Geometry has no anomalous geometric points, such as self intersection or self tangency.
  • ST_Length3D – Returns the 3-dimensional or 2-dimensional length of the geometry if it is a linestring or multi-linestring.
  • ST_Length3D_Spheroid – Calculates the length of a geometry on an ellipsoid, taking the elevation into account. This is just an alias for ST_Length_Spheroid.
  • ST_Length_Spheroid – Calculates the 2D or 3D length of a linestring/multilinestring on an ellipsoid. This is useful if the coordinates of the geometry are in longitude/latitude and a length is desired without reprojection.
  • ST_LineFromMultiPoint – Creates a LineString from a MultiPoint geometry.
  • ST_LineToCurve – Converts a LINESTRING/POLYGON to a CIRCULARSTRING, CURVED POLYGON
  • ST_Line_Interpolate_Point – Returns a point interpolated along a line. Second argument is a float8 between 0 and 1 representing fraction of total length of linestring the point has to be located.
  • ST_Line_Substring – Return a linestring being a substring of the input one starting and ending at the given fractions of total 2d length. Second and third arguments are float8 values between 0 and 1.
  • ST_LocateBetweenElevations – Return a derived geometry (collection) value with elements that intersect the specified range of elevations inclusively. Only 3D, 4D LINESTRINGS and MULTILINESTRINGS are supported.
  • ST_M – Return the M coordinate of the point, or NULL if not available. Input must be a point.
  • ST_MakeBox3D – Creates a BOX3D defined by the given 3d point geometries.
  • ST_MakeLine – Creates a Linestring from point geometries.
  • ST_MakePoint – Creates a 2D,3DZ or 4D point geometry.
  • ST_MakePolygon – Creates a Polygon formed by the given shell. Input geometries must be closed LINESTRINGS.
  • ST_MemUnion – Same as ST_Union, only memory-friendly (uses less memory and more processor time).
  • ST_Mem_Size – Returns the amount of space (in bytes) the geometry takes.
  • ST_NDims – Returns coordinate dimension of the geometry as a small int. Values are: 2,3 or 4.
  • ST_NPoints – Return the number of points (vertexes) in a geometry.
  • ST_NRings – If the geometry is a polygon or multi-polygon returns the number of rings.
  • ST_Perimeter3D – Returns the 3-dimensional perimeter of the geometry, if it is a polygon or multi-polygon.
  • ST_PointN – Return the Nth point in the first linestring or circular linestring in the geometry. Return NULL if there is no linestring in the geometry.
  • ST_PointOnSurface – Returns a POINT guaranteed to lie on the surface.
  • ST_Polygon – Returns a polygon built from the specified linestring and SRID.
  • ST_RemovePoint – Removes point from a linestring. Offset is 0-based.
  • ST_Rotate – This is a synonym for ST_RotateZ
  • ST_RotateX – Rotate a geometry rotRadians about the X axis.
  • ST_RotateY – Rotate a geometry rotRadians about the Y axis.
  • ST_RotateZ – Rotate a geometry rotRadians about the Z axis.
  • ST_Scale – Scales the geometry to a new size by multiplying the ordinates with the parameters. Ie: ST_Scale(geom, Xfactor, Yfactor, Zfactor).
  • ST_SetPoint – Replace point N of linestring with given point. Index is 0-based.
  • ST_Shift_Longitude – Reads every point/vertex in every component of every feature in a geometry, and if the longitude coordinate is <0,>
  • ST_SnapToGrid – Snap all points of the input geometry to the grid defined by its origin and cell size. Remove consecutive points falling on the same cell, eventually returning NULL if output points are not enough to define a geometry of the given type. Collapsed geometries in a collection are stripped from it. Useful for reducing precision.
  • ST_StartPoint – Returns the first point of a LINESTRING geometry as a POINT.
  • ST_Summary – Returns a text summary of the contents of the ST_Geometry.
  • ST_SymDifference – Returns a geometry that represents the portions of A and B that do not intersect. It is called a symmetric difference because ST_SymDifference(A,B) = ST_SymDifference(B,A).
  • ST_TransScale – Translates the geometry using the deltaX and deltaY args, then scales it using the XFactor, YFactor args, working in 2D only.
  • ST_Translate – Translates the geometry to a new location using the numeric parameters as offsets. Ie: ST_Translate(geom, X, Y) or ST_Translate(geom, X, Y,Z).
  • ST_Union – Returns a geometry that represents the point set union of the Geometries.
  • ST_X – Return the X coordinate of the point, or NULL if not available. Input must be a point.
  • ST_XMax – Returns X maxima of a bounding box 2d or 3d or a geometry.
  • ST_XMin – Returns X minima of a bounding box 2d or 3d or a geometry.
  • ST_Y – Return the Y coordinate of the point, or NULL if not available. Input must be a point.
  • ST_YMax – Returns Y maxima of a bounding box 2d or 3d or a geometry.
  • ST_YMin – Returns Y minima of a bounding box 2d or 3d or a geometry.
  • ST_Z – Return the Z coordinate of the point, or NULL if not available. Input must be a point.
  • ST_ZMax – Returns Z minima of a bounding box 2d or 3d or a geometry.
  • ST_ZMin – Returns Z minima of a bounding box 2d or 3d or a geometry.
  • ST_Zmflag – Returns ZM (dimension semantic) flag of the geometries as a small int. Values are: 0=2d, 1=3dm, 2=3dz, 3=4d.
  • UpdateGeometrySRID – Updates the SRID of all features in a geometry column, geometry_columns metadata and srid table constraint

PostGIS Curved Geometry Support Functions

The functions given below are PostGIS functions that can use CIRCULARSTRING, CURVEDPOLYGON, and other curved geometry types

  • AddGeometryColumn – Adds a geometry column to an existing table of attributes.
  • DropGeometryColumn – Removes a geometry column from a spatial table.
  • GeometryType – Returns the type of the geometry as a string. Eg: ‘LINESTRING’, ‘POLYGON’, ‘MULTIPOINT’, etc.
  • ST_Accum – Aggregate. Constructs an array of geometries.
  • ST_AddBBox – Add bounding box to the geometry.
  • ST_Affine – Applies a 3d affine transformation to the geometry to do things like translate, rotate, scale in one step.
  • ST_AsEWKB – Return the Well-Known Binary (WKB) representation of the geometry with SRID meta data.
  • ST_AsEWKT – Return the Well-Known Text (WKT) representation of the geometry with SRID meta data.
  • ST_AsHEXEWKB – Returns a Geometry in HEXEWKB format (as text) using either little-endian (NDR) or big-endian (XDR) encoding.
  • ST_AsText – Return the Well-Known Text (WKT) representation of the geometry without SRID metadata.
  • ST_Box2D – Returns a BOX2D representing the maximum extents of the geometry.
  • ST_Box3D – Returns a BOX3D representing the maximum extents of the geometry.
  • ST_Collect – Return a specified ST_Geometry value from a collection of other geometries.
  • ST_CoordDim – Return the coordinate dimension of the ST_Geometry value.
  • ST_CurveToLine – Converts a CIRCULARSTRING/CURVEDPOLYGON to a LINESTRING/POLYGON
  • ST_DropBBox – Drop the bounding box cache from the geometry.
  • ST_Dump – Returns a set of geometry_dump (geom,path) rows, that make up a geometry g1.
  • ST_Estimated_Extent – Return the ‘estimated’ extent of the given spatial table. The estimated is taken from the geometry column’s statistics. The current schema will be used if not specified.
  • ST_Extent3D – an aggregate function that returns the box3D bounding box that bounds rows of geometries.
  • ST_Force_2D – Forces the geometries into a “2-dimensional mode” so that all output representations will only have the X and Y coordinates.
  • ST_Force_3D – Forces the geometries into XYZ mode. This is an alias for ST_Force_3DZ.
  • ST_Force_3DM – Forces the geometries into XYM mode.
  • ST_Force_3DZ – Forces the geometries into XYZ mode. This is a synonym for ST_Force_3D.
  • ST_Force_4D – Forces the geometries into XYZM mode.
  • ST_Force_Collection – Converts the geometry into a GEOMETRYCOLLECTION.
  • ST_GeoHash – Return a GeoHash representation (geohash.org) of the geometry.
  • ST_GeomFromEWKB – Return a specified ST_Geometry value from Extended Well-Known Binary representation (EWKB).
  • ST_GeomFromEWKT – Return a specified ST_Geometry value from Extended Well-Known Text representation (EWKT).
  • ST_GeomFromText – Return a specified ST_Geometry value from Well-Known Text representation (WKT).
  • ST_GeomFromWKB – Creates a geometry instance from a Well-Known Binary geometry representation (WKB) and optional SRID.
  • ST_GeometryN – Return the 1-based Nth geometry if the geometry is a GEOMETRYCOLLECTION, MULTIPOINT, MULTILINESTRING, MULTICURVE or MULTIPOLYGON. Otherwise, return NULL.
  • ST_HasArc – Returns true if a geometry or geometry collection contains a circular string
  • ST_HasBBox – Returns TRUE if the bbox of this geometry is cached, FALSE otherwise.
  • ST_IsClosed – Returns TRUE if the LINESTRING’s start and end points are coincident.
  • ST_IsEmpty – Returns true if this Geometry is an empty geometry . If true, then this Geometry represents the empty point set – i.e. GEOMETRYCOLLECTION(EMPTY).
  • ST_LineToCurve – Converts a LINESTRING/POLYGON to a CIRCULARSTRING, CURVED POLYGON
  • ST_Mem_Size – Returns the amount of space (in bytes) the geometry takes.
  • ST_NPoints – Return the number of points (vertexes) in a geometry.
  • ST_NRings – If the geometry is a polygon or multi-polygon returns the number of rings.
  • ST_PointFromWKB – Makes a geometry from WKB with the given SRID
  • ST_PointN – Return the Nth point in the first linestring or circular linestring in the geometry. Return NULL if there is no linestring in the geometry.
  • ST_Rotate – This is a synonym for ST_RotateZ
  • ST_RotateZ – Rotate a geometry rotRadians about the Z axis.
  • ST_SRID – Returns the spatial reference identifier for the ST_Geometry as defined in spatial_ref_sys table.
  • ST_Scale – Scales the geometry to a new size by multiplying the ordinates with the parameters. Ie: ST_Scale(geom, Xfactor, Yfactor, Zfactor).
  • ST_SetSRID – Sets the SRID on a geometry to a particular integer value.
  • ST_TransScale – Translates the geometry using the deltaX and deltaY args, then scales it using the XFactor, YFactor args, working in 2D only.
  • ST_Transform – Returns a new geometry with its coordinates transformed to the SRID referenced by the integer parameter.
  • ST_Translate – Translates the geometry to a new location using the numeric parameters as offsets. Ie: ST_Translate(geom, X, Y) or ST_Translate(geom, X, Y,Z).
  • ST_XMax – Returns X maxima of a bounding box 2d or 3d or a geometry.
  • ST_XMin – Returns X minima of a bounding box 2d or 3d or a geometry.
  • ST_YMax – Returns Y maxima of a bounding box 2d or 3d or a geometry.
  • ST_YMin – Returns Y minima of a bounding box 2d or 3d or a geometry.
  • ST_ZMax – Returns Z minima of a bounding box 2d or 3d or a geometry.
  • ST_ZMin – Returns Z minima of a bounding box 2d or 3d or a geometry.
  • ST_Zmflag – Returns ZM (dimension semantic) flag of the geometries as a small int. Values are: 0=2d, 1=3dm, 2=3dz, 3=4d.
  • UpdateGeometrySRID – Updates the SRID of all features in a geometry column, geometry_columns metadata and srid table constraint

New PostGIS Functions

The functions given below are PostGIS functions that were introduced in this major release.

  • Populate_Geometry_Columns – Ensures geometry columns have appropriate spatial constraints and exist in the geometry_columns table. Availability: 1.4.0
  • ST_Collect – Return a specified ST_Geometry value from a collection of other geometries. Availability: 1.4.0 – ST_Collect(geomarray) was introduced. ST_Collect was enhanced to handle more geometries faster.
  • ST_ContainsProperly – Returns true if B intersects the interior of A but not the boundary (or exterior). A does not contain properly itself, but does contain itself. Availability: 1.4.0 – requires GEOS >= 3.1.0.
  • ST_GeoHash – Return a GeoHash representation (geohash.org) of the geometry. Availability: 1.4.0
  • ST_IsValidReason – Returns text stating if a geometry is valid or not and if not valid, a reason why. Availability: 1.4 – requires GEOS >= 3.1.0.
  • ST_LineCrossingDirection – Given 2 linestrings, returns a number between -3 and 3 denoting what kind of crossing behavior. 0 is no crossing. Availability: 1.4
  • ST_LocateBetweenElevations – Return a derived geometry (collection) value with elements that intersect the specified range of elevations inclusively. Only 3D, 4D LINESTRINGS and MULTILINESTRINGS are supported. Availability: 1.4.0
  • ST_MakeLine – Creates a Linestring from point geometries. Availability: 1.4.0 – ST_MakeLine(geomarray) was introduced. ST_MakeLine aggregate functions was enhanced to handle more points faster.
  • ST_MinimumBoundingCircle – Returns the smallest circle polygon that can fully contain a geometry. Default uses 48 segments per quarter circle. Availability: 1.4.0 – requires GEOS
  • ST_Union – Returns a geometry that represents the point set union of the Geometries. Availability: 1.4.0 – ST_Union was enhanced. ST_Union(geomarray) was introduced and also faster aggregate collection in PostgreSQL. If you are using GEOS 3.1.0+ ST_Union will use the faster Cascaded Union algorithm described in http://blog.cleverelephant.ca/2009/01/must-faster-unions-in-postgis-14.html

The functions given below are PostGIS functions that were introduced in the 1.3 release.

  • ST_AsGeoJSON – Return the geometry as a GeoJSON element. Availability: 1.3.4
  • ST_SimplifyPreserveTopology – Returns a “simplified” version of the given geometry using the Douglas-Peuker algorithm. Will avoid creating derived geometries (polygons in particular) that are invalid. Availability: 1.3.3

Prevent Response Caching in AJAX

Add following three lines to your php code at the top which will prevent your response from getting cached which may be required in some cases.

header(‘Pragma: no-cache’);

header(‘Cache-Control: no-cache’);

header(‘Expires: 0′);

Cannot modify header information – headers already sent

The header should come first in the response from a web server and is separated from the body by one blank line. The reason this error occurs is that some part of the body of the web page has been sent to the user already when a request is made to set a header value. Because PHP simplifies many things for you, the problem may be hiding in plain site. Here are some guidelines for finding the problem:

1) Find the header() statement that is causing the problem. The error must be at or before this line.

2) Look for any statements that could send output to the user before this header statement. If you find one or more, find some way to move the header statement before them. Complex conditional statements may complicate the issue, but they may also help solve the problem. Consider a conditional expression at the top of the PHP script that determines the header value as early as possible and sets it there.

3) Make sure there is no white space outside of the php start and end tags. While a blank line before the
;

FGS Installation

Steps to FGS Installation
FGS Base
1. Download the self-extracting file to your local directory.
For example:

  • $ wget http://dl.maptools.org/dl/fgs/releases/1.0/1.0.0/self-installers/
    fgs-mapserver_5.0.2-fgs_1.0.0-linux-i386.bin
  • Run it with: $ sh fgs-mapserver_5.0.2-fgs_1.0.0-linux-i386.bin

2. Press to begin the installer

3. Enter the path to where you want to install

*note that pressing will accept the default path displayed
*your path will become $FGS_HOME for the purpose of this doc
*extraction process will then begin

4. Specify the TCP Port that you want to use

*note that if you are installing this as a regular user Port 80
and any port under 1024 are restricted to root access

5. Install complete

6. To test your installation of MapServer/GMap, in a browser goto

  • http://yourserver:port/cgi-bin/mapserv/

*you should see the following message displayed:
“No query information to decode. QUERY_STRING is set, but empty”.

7. For more up-to-date information please see the README.txt in your FGS distribution.

Modules

Modules are individual components of the FGS package, and can be found here by selecting the “modules” directory under a specific version. It is better to stop apache before a module installation and to restart it after.

To install a specific module in the FGS environment, execute the following command:

  • $ fgs install module-name:version from-where
  • An example command could be:
  • $ fgs install tilecache-base:2.10 http://dl.maptools.org/dl/fgs/releases/9.5/modules/
  • You can view your list of installed modules in $FGS_HOME/etc/fgs/pkgs/
  • To upgrade an existing module you have to use the following command:
  • $ fgs force-install module-name:version from-where
    An example could be:
  • $ fgs force-install tilecache-base:2.10 http://dl.maptools.org/dl/fgs/releases/9.5/modules/
  • Setting up PGSQL driver for FGS
  • Add line ‘extension = pgsql.so’ to file php5.ini.template. Path for this file is
  • FGSINSTALLTIONFOLDER /www/conf
  • Copy files pgsql.so ,pdo_pgsql.so and pdo.so to FGSINSTALLTIONFOLDER /www/lib from /usr/lib/php5 folder
  • Restart server.

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