[gdal-dev] loading geometries only into postgis via ogr2ogr using shp file only as input

karsten karsten at terragis.net
Thu Jun 7 16:43:52 PDT 2012


Hi All, 

I posted the question below in the PostGIS email and local CUGOS email lists
and got some good input. 
Now I wanted to determine how hard it would be to 'hack' the ogr2ogr utility
program to be able to only load the geometries of a shape file (shp file
only, without shx and dbf that are usually required) into PostGIS. Thus only
the geometry is needed and a unique id, the test that ogr2ogr does if shx
and dbf are present should be omitted (that is that hack I am talking about)
Any ideas on that if that could be accomplished with by hacking ogr2ogr
without too much trouble ? Or is there any other utility tool out there to
get this done preferably without programming :)

Cheers 
Karsten 

Terra GIS LTD 
 <blocked::http://www.terragis.net/> www.terragis.net
............................................................................
............................................................................
............................................................................
>>> I am working on a data upload function where for a web map a user can
upload a shape file onto the server, the file will then be loaded via a
utility into PostGIS e.g. using ogr2ogr or shp2pgsql. 
Now we all know that usually a shape files has at least 3 files shp, shx and
dbf to be complete... but unusually - well I was wondering if it would be
possible to only use a shp file alone to load the geometry to PostGIS (if it
is ok to loose index and attributes) 

The reason is this would have several advantages for the work I am tying to
do 
1. the shape file is user provided (if will be always 'simple' polygon
shapes, but due to that will always have non consistent attributes (i.e not
the same table schema) which are not needed anyway for the purposes of the
app 
2. the geometry alone will be used to show areas of Interest for the user on
the map (attributes are not needed, only location and extent matters) 
3. inconsistencies of differing attributes will not be a problem if I could
in fact only import the geometry to PostGIS and simply add a unique gid and
user id as only default attributes to the PostGIS table 
4. another advantage would be that only the single shp file alone would need
to be uploaded to the server :) >>>>
............................................................................
...................................... 





=======
Email scanned by PC Tools - No viruses or spyware found.
(Email Guard: 9.0.0.888, Virus/Spyware Database: 6.19840)
http://www.pctools.com/
=======
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120607/e4d0affa/attachment-0001.html>


More information about the gdal-dev mailing list