How to creat a shape file from postgresql table

Paul Spencer pspencer at DMSOLUTIONS.CA
Mon Mar 7 13:30:25 EST 2005


Afifa,

there is a utility that comes with postgis called pgsql2shp but that
assumes you have postgis installed and are using geometry columns.

If this is not your case, you have several options:

* you can install postgis into your postgres, add a geometry column, and
run an sql command using GeometryFromText and appropriate string
concatentation to build your points from existing lon/lat columns

* you can use the ogr2ogr utility to convert from any supported format
to any supported format.

http://gdal.maptools.org/ogr/ogr_utilities.html

http://gdal.maptools.org/ogr/ogr_formats.html

OGR supports access to databases that are not inherently spatial (i.e.
postgres without postgis) using the virtual format driver (VRT), I
encourage you to use the GDAL mailing list for information on pursuing this.

* you can write a script in PHP or some other scripting language that
MapServer supports and use the script support for enumerating your
database and MapServer's support for scripting the ShapefileObj

Cheers

Paul


Afifa Naz wrote:
> Hi
>
> I am wondering if any one can help me or forward me a code that can help
> me to create a shape file from a postgresql table.
>
> Thanks
> Afifa
>

--
+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+



More information about the mapserver-users mailing list