[postgis-users] Using OGR2OGR to export postgis data to other mapinfo

Frank Warmerdam warmerdam at pobox.com
Wed Jun 11 07:35:57 PDT 2003

Obe, Regina DND\MIS wrote:
> Frank,
> Thanks that worked and dumps out the tab file now. Now I feel kind of stupid
> for such a simple solution.
> There is one other problem, which I haven't figured out why it is happening.
> For certain tables with spatial fields, it doesn't generate anything.  I
> thought maybe it had to do with the geometry_columns table not having a
> record for a particular table - but doesn't work for some of those either.
> I'm still trouble-shooting that.


I don't know why this would be.

> It also doesn't seem to work for views - even if I put in an entry in
> geometry_columns, although this could be related to problem above.

Right, views are not currently supported to treat as regular layers.  However,
if you use the -sql option to query a view it should work.  The -sql option
to ogr2ogr allows you to pass arbitrary SQL queries to PostgreSQL and then
it tries to interprete the result as a spatial or non-spatial table.

> Now my final question -- If I have two spatial fields in a table -- is there
> anyway to denote which spatial field to dump out or would I need to
> explicitly specify it in the 
> -select option field list?

I don't think it will work with -select since that mechanism only works for
what OGR considers "regular fields" which does not include spatial fields.
However, a -sql query which explicitly includes only one spatial field should
be OK.  I would add that I never really imagined support for multiple
spatial fields being very useful so I "simplified" things by ignoring the

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 postgis-users mailing list