Discussion:
Upload a shapefile to PostGIS via Web?
Xiaoyu Guan
2008-08-13 11:30:37 UTC
Permalink
Dear All:

I am a new user to PostGIS. I would like to know is there any web packages
which can allow user upload ESRI shape file to PostGIS.
Thanks in advance

All the best

Xiaoyu
--
Xiaoyu Guan (Sam)
Geo-information Science
Wageningen UR
David Calle
2008-08-13 16:25:47 UTC
Permalink
Hi, Xiaoyu

So Interesting... but I know only with promp command on Postgresql...
Jose Gomez-Dans
2008-08-13 16:59:21 UTC
Permalink
Hi,
Post by Xiaoyu Guan
I am a new user to PostGIS. I would like to know is there any web packages
which can allow user upload ESRI shape file to PostGIS.
Can't you just call a CGI script that uses ogr2ogr or something like that to
import the data? You can also use ogr directly from (say) python and import
the data on the fly, I guess...
--
Centre for Terrestrial Carbon Dynamics
Department of Geography, University College London
Gower Street, London WC1E 6BT, UK
David Calle
2008-08-13 17:35:16 UTC
Permalink
Also you can select the origin of your data.... on your map file....
Luigi Castro Cardeles
2008-08-13 17:51:56 UTC
Permalink
HI,
i think that you need to download the file (shp, dbf e shx) to some folder
and run (via shell script or something - using cron) the conversion. You
need some information about your shapefile (CRS, SRS etc), maybe the user
could pass that via form. I think that is the easy way. but if you have
problems with the conversion... you have think how to deal with that.
[]'s
Post by David Calle
Also you can select the origin of your data.... on your map file....
_______________________________________________
postgis-users mailing list
http://postgis.refractions.net/mailman/listinfo/postgis-users
--
Luigi Castro Cardeles
Steffen Macke
2008-08-13 20:05:47 UTC
Permalink
Hi,

The DCMMS web application has a "shapefile loader" that allows to load
zipped shapefiles into PostGIS:

http://dcmms.svn.sourceforge.net/viewvc/dcmms/trunk/dcmms/admin/shapefile_loader.php?revision=1085&view=markup

I guess you'll have to adjust the code a little bit, but it might be a
good starting point.

Regards,

Steffen
Xiaoyu Guan
2008-08-14 08:38:37 UTC
Permalink
Hi Luigi:

yes, I also see the problem, there are at least two steps, step1: zip all
shapefile and upload. step 2: extract zip file, and import to certain
database. Maybe there is one way or some people are already working on it. I
am think whether possible translate OGR2OGR or Shp2pgsql into python or
other languages, which user can runing the conversion part at server side.
That s what I am thinking about the solution.
Thanks for your reply.

All the best

Xiaoyu
--
Xiaoyu Guan (Sam)
Geo-information Science
Wageningen UR
Guido Lemoine
2008-08-14 08:51:18 UTC
Permalink
Luigi et al,

If you use a Java environment, you would want to look at Geotools (can
parse shapefiles to Postgis)
and a servlet or JSP set-up for multi-part request processing on the
server. If you are familiar with
Groovy and Grails, I can recommend that to make the coding a lot easier.

GL
Post by Xiaoyu Guan
yes, I also see the problem, there are at least two steps, step1: zip
all shapefile and upload. step 2: extract zip file, and import to
certain database. Maybe there is one way or some people are already
working on it. I am think whether possible translate OGR2OGR or
Shp2pgsql into python or other languages, which user can runing the
conversion part at server side. That s what I am thinking about the
solution.
Thanks for your reply.
All the best
Xiaoyu
--
Xiaoyu Guan (Sam)
Geo-information Science
Wageningen UR
------------------------------------------------------------------------
_______________________________________________
postgis-users mailing list
http://postgis.refractions.net/mailman/listinfo/postgis-users
--
----------------------------------------------------------------
Guido Lemoine
Joint Research Centre, European Commission
Institute for the Protection and Security of the Citizen (IPSC)
Support to External Security
Via E. Fermi, 2749 TP 267 Ispra 21027 (VA), Italy
Tel. +39 0332 786239 (direct line) Fax. +39 0332 785154
WWW: http://ses.jrc.it
----------------------------------------------------------------
Disclaimer:
Views expressed are those of the individual and do not represent
the views of the European Commission
Barend Kobben
2008-08-14 12:06:44 UTC
Permalink
Or use the OS gis-viewer QuantumGIS (www.qgis.org) it has a plugin called
SPIT which allows you to load the file in QGIS and then upload to PostGIS...
--
Barend Köbben
International Institute for Geo-Information
Sciences and Earth Observation (ITC)
PO Box 6
7500AA Enschede, The Netherlands
+31 (0)53 4874253
Post by Guido Lemoine
Luigi et al,
If you use a Java environment, you would want to look at Geotools (can
parse shapefiles to Postgis)
and a servlet or JSP set-up for multi-part request processing on the
server. If you are familiar with
Groovy and Grails, I can recommend that to make the coding a lot easier.
GL
Post by Xiaoyu Guan
yes, I also see the problem, there are at least two steps, step1: zip
all shapefile and upload. step 2: extract zip file, and import to
certain database. Maybe there is one way or some people are already
working on it. I am think whether possible translate OGR2OGR or
Shp2pgsql into python or other languages, which user can runing the
conversion part at server side. That s what I am thinking about the
solution.
Thanks for your reply.
All the best
Xiaoyu
--
Xiaoyu Guan (Sam)
Geo-information Science
Wageningen UR
------------------------------------------------------------------------
_______________________________________________
postgis-users mailing list
http://postgis.refractions.net/mailman/listinfo/postgis-users
International Institute for Geo-Information Science and Earth Observation (ITC)
Chamber of Commerce: 410 27 560

E-mail disclaimer
The information in this e-mail, including any attachments, is intended for the addressee only. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or action in relation to the content of this information is strictly prohibited. If you have received this e-mail by mistake, please delete the message and any attachment and inform the sender by return e-mail. ITC accepts no liability for any error or omission in the message content or for damage of any kind that may arise as a result of e-mail transmission.
Luigi Castro Cardeles
2008-08-14 12:17:33 UTC
Permalink
Hi Xian,

there is some bindings to ogr (phpogr, pyrhon etc). Maybe you should see
something.
Why you want to upload shp files direct to PostGIS via web? Is there really
need? Are you trying to make some type of WFS with this data?
Maybe is there some other solution for your problem.
[]'s
Post by Guido Lemoine
Luigi et al,
If you use a Java environment, you would want to look at Geotools (can
parse shapefiles to Postgis)
and a servlet or JSP set-up for multi-part request processing on the
server. If you are familiar with
Groovy and Grails, I can recommend that to make the coding a lot easier.
GL
Post by Xiaoyu Guan
yes, I also see the problem, there are at least two steps, step1: zip all
shapefile and upload. step 2: extract zip file, and import to certain
database. Maybe there is one way or some people are already working on it. I
am think whether possible translate OGR2OGR or Shp2pgsql into python or
other languages, which user can runing the conversion part at server side.
That s what I am thinking about the solution.
Thanks for your reply.
All the best
Xiaoyu
--
Xiaoyu Guan (Sam)
Geo-information Science
Wageningen UR
------------------------------------------------------------------------
_______________________________________________
postgis-users mailing list
http://postgis.refractions.net/mailman/listinfo/postgis-users
--
----------------------------------------------------------------
Guido Lemoine
Joint Research Centre, European Commission
Institute for the Protection and Security of the Citizen (IPSC)
Support to External Security
Via E. Fermi, 2749 TP 267 Ispra 21027 (VA), Italy
Tel. +39 0332 786239 (direct line) Fax. +39 0332 785154
WWW: http://ses.jrc.it
----------------------------------------------------------------
Views expressed are those of the individual and do not represent the views
of the European Commission
--
Luigi Castro Cardeles
Bernd Deckert
2008-08-14 15:16:35 UTC
Permalink
Hi Xiaoyu,

Geolabs is at the origin of the opensource Web-GIS "Mapjax"
(http://mapjax.org/mapjax/) project :
The main pieces of software where Mapjax is based on are :
- Postgresql/PostGIS
- GDAL/OGR libraries
- UMN Mapserver : PHP Mapscript

Mapjax has his own web-based backoffice to build up and generate Web-GIS
sites and geowebservices.

Here some functionalities of the backoffice you may be interested in :

- import Shapefiles or Mapinfo files into PostGIS (through OGR2OGR).
- export data from PostGIS to serveral geodata file formats : Shapefile,
Mapinfo (.tab), KML etc.
- publish PostGIS geodata tables as WMS and WFS layers (through Mapserver).
- generate tilecache for Google maps or Mapserver.

Feel free to try out Mapjax or to take a look into sourcecode to find
the solution for your needs.

Bernd
Post by Xiaoyu Guan
yes, I also see the problem, there are at least two steps, step1: zip
all shapefile and upload. step 2: extract zip file, and import to
certain database. Maybe there is one way or some people are already
working on it. I am think whether possible translate OGR2OGR or
Shp2pgsql into python or other languages, which user can runing the
conversion part at server side. That s what I am thinking about the
solution.
Thanks for your reply.
All the best
Xiaoyu
--
Xiaoyu Guan (Sam)
Geo-information Science
Wageningen UR
------------------------------------------------------------------------
_______________________________________________
postgis-users mailing list
http://postgis.refractions.net/mailman/listinfo/postgis-user
--
Bernd DECKERT
***@geolabs.fr

GeoLabs
Future Building I
1280, avenue des Platanes
34970 Lattes
Tél. fixe : 04 67 53 67 37
mail: ***@geolabs.fr
Xiaoyu Guan
2008-08-15 07:51:22 UTC
Permalink
Dear all:
Thanks for your information. I still have no time to check all the
information. it is nice to know we are working on the same problems.
Here I also found some PHP source code from OGR. please, check the following
link.
http://dl.maptools.org/dl/php_ogr/php_ogr_documentation.html
The OGR/PHP extension enables PHP users to access the functionalities
included in the OGR library. This extension can be used as built-in PHP or
as dynamic library (".dll" on Windows or ".so" on Unix).

The problem is that the version of OGR/PHP for windows platform is quite
old. it is need PHP 4.3.x. It is easy to install PHP, but it is not easy to
find PHP 4.3 win installer.

until now, I have already see there are some solutions are writen in PHP. I
am still wonder whether possible to write a python script which allow user
from web access the shp2pgsql on the server? Maybe it is take less time for
converting.

QGIS is a nice tool. but for this case, we need a thin client (Web client).

All the best

Xiaoyu
Nico Mandery
2008-08-15 08:59:50 UTC
Permalink
Hi Xiaoyu,

when you are talking about wirting a python scripting - there are up to
date python bindings for the OGR library.
So you could parse your shapefile with python and write it directly to
the database.For the documentation the python bindings see [1], you can
also find some example code at Matt Perry´s blog at [2].

For accessing the database you can use the ogr-library again or the
pycopg2 postgres driver [3].

Links:
[1] http://trac.osgeo.org/gdal/wiki/GdalOgrInPython
[2] http://www.perrygeo.net/wordpress/?p=4
[3] http://pypi.python.org/pypi/psycopg2/2.0.4

Nico
Post by Xiaoyu Guan
Thanks for your information. I still have no time to check all the
information. it is nice to know we are working on the same problems.
Here I also found some PHP source code from OGR. please, check the
following link.
http://dl.maptools.org/dl/php_ogr/php_ogr_documentation.html
The OGR/PHP extension enables PHP users to access the functionalities
included in the OGR library. This extension can be used as built-in
PHP or as dynamic library (".dll" on Windows or ".so" on Unix).
The problem is that the version of OGR/PHP for windows platform is
quite old. it is need PHP 4.3.x. It is easy to install PHP, but it is
not easy to find PHP 4.3 win installer.
until now, I have already see there are some solutions are writen in
PHP. I am still wonder whether possible to write a python script which
allow user from web access the shp2pgsql on the server? Maybe it is
take less time for converting.
QGIS is a nice tool. but for this case, we need a thin client (Web client).
All the best
Xiaoyu
------------------------------------------------------------------------
_______________________________________________
postgis-users mailing list
http://postgis.refractions.net/mailman/listinfo/postgis-users
Xiaoyu Guan
2008-08-15 20:37:13 UTC
Permalink
Hi Nico
Thanks very much for your information.
I will check them out in next week.

All the best

Xiaoyu

Loading...