[Gdal-dev] ntf to postgres tables

Frank Warmerdam warmerdam at pobox.com
Thu Dec 12 09:39:02 EST 2002


nida Khan wrote:
> Hi List,
>  
> I have recently started using ogr2ogr. It works fine, but I have some 
> confusion and hoping that anyone can shade the light.
> here r the steps I follow.
>  
> first I use ogrInfo on ntf file,
> ogrInfo blah.ntf
> 1: BL2000_LINK (Line String)
> 2: BL2000_POLY (None)
> 3: BL2000_COLLECTIONS (None)
> 4: FEATURE_CLASSES (None)
>  
> ogr2ogr <directory name> blah.ntf  BL2000_LINK
>  
> this generate .shp,.dbf,shx and .prj  files in the directory
> now I use shp2pgsql to create dump file.
>  
> confusion comes when I run the ogr2ogr command against a layer with  no 
> geo. type
> it only creates a .dbf and .prj file.
> how do I import these files in postgres?
> I think these layers contain other features realted to first geo. layer.
>  

Nida,

Layers without geometries are represented as just a .dbf file by the shapefile
writer.  These are just not supported by shp2pgsql, though there might well
be other .dbf loaders for PostgreSQL available from somewhere.

I should warn you that the UK NTF driver does not assemble the line geometries
to create polygons or collections.  It just attaches the ids of the geometries
in question as an attribute on the poly and collection features.  In other
environments (FME) further processing steps take care of assembling the
polygons.

However, you can still load the geometry-less layers if you use a build of
OGR with direct PostGIS support.  For example, the following command will
load all the layers of HALTON.NTF directly into a PostGIS enabled database
named 'test'.

eg.

ogr2ogr -update PG:dbname=test HALTON.NTF

To check if you have a PostGIS ogr build you can just type "ogr2ogr"
to list the support formats.  If you see '-f "PostgreSQL"' the it is
built-in.

One more caveat.  In testing this case I discovered a couple of bugs in
OGR's PG driver which I have fixed.  One of those bugs precludes loading
tables without geometries into PostGIS!  I would suggest you wait for
a new daily CVS snapshot and work from that.

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent





More information about the Gdal-dev mailing list