[Qgis-user] mapinfo file to postgis

Bo Victor Thomsen bo.victor.thomsen at gmail.com
Thu Sep 5 00:32:32 PDT 2013


Ibad -

First: The wkb_geometry geometry(MultiLineString,900914) part means that 
your table contains multiline geoobject in the projection EPSG:900914

I suspect you have run two errors in ogr2ogr.

I've done some digging into the problem:

I've attached a tab-file in projection epsg:25832 (that's utm32/etrs89). 
It contains 7 rows: one row each of geotype POINT, MULTIPOINT 
..,MULTIPOLYGON, NONE. When I use the ogr2ogr command from my previous 
post 2 things happens:

 1. I get 6 - not 7 - new tables into my database.  The table with
    geometry type 'NONE' is missing. That means the *-where
    "OGR_GEOMETRY='%a' *command option fails for geometry type "none"
 2. The 6 tables has all the projection epsg:900915 (AFAIK this is
    "Google spherical mercator" projection). It's not epsg:25832. This
    means that ogr2ogr can't reliably transfer the projection of the
    tabfile into postgis.

add 1) Sorry, at the moment you can't use my method to transfer rows 
with no geometry from a tab file into postgresql.

add 2) As a workaround, you can manually define the projection by using 
the -a_srs option in the ogr2ogr. Change the command to:

*for %a in (multilinestring multipolygon linestring polygon point 
multipoint none) do ogr2ogr -where "OGR_GEOMETRY='%a'" -a_srs EPSG:/nnnn 
/-f "PostgreSQL" 
PG:"host=**/myserver/**user=**/myuser/**dbname=**/mydatabase/**password=**/mypassword/**" 
-nlt %a -nln **/tablename/**_%a **/mytabfile.tab/*

*/nnnn /*must be the epsg number for the projection used in your mapinfo 
table.

I will file two bug reports for the ogr2ogr errors.

Regards
Bo Victor Thomsen
Aestas-GIS

Den 05-09-2013 06:58, ibad raza skrev:
> thanks Bo victor Thomsen
>
> I have tried this query and was able to add different types of 
> geometries into my postgis
> however the geometry column of every tables reads as wkb_geometry 
> geometry(MultiLineString,900914),
>
> can anyone explain to me that what does this means, a normal geometry 
> table only has only this argument wkb_geometry geometry,
>
>
> best
> Ibad Raza
>
>
> On Thu, Sep 5, 2013 at 2:49 AM, Bo Victor Thomsen 
> <bo.victor.thomsen at gmail.com <mailto:bo.victor.thomsen at gmail.com>> wrote:
>
>     Ibad -
>
>     The problem is that MapInfo tab files can contain several types of
>     geometry object all mixed together - lines, polygons, points ...
>     in a single file. This is not allowed in Postgis tables used by QGIS.
>     You have to split your "multi-type" tab file into several postgis
>     tables, where each table only contains one type of geoobject
>
>     Try the following on a command line (in windows):
>
>     *for %a in (multilinestring multipolygon linestring polygon point
>     multipoint none) do ogr2ogr -where "OGR_GEOMETRY='%a'" -f
>     "PostgreSQL"
>     PG:"host=**/myserver/**user=**/myuser/**dbname=**/mydatabase/**password=**/mypassword/**"
>     -nlt %a -nln **/tablename/**_%a **/mytabfile.tab/*
>
>     - Replace italic text as needed
>     - If the commandline is put into a .cmd file: Replace every
>     occurence of %a with %%a
>
>     The command will create 7 new layers for each tabfile. Each new
>     table will only contain one type of object (Depending on the
>     contents of the tabfile, some or most of the tables will be empty)
>
>     Regards
>     Bo Victor Thomsen
>     Aestas-GIS
>     Denmark
>
>
>     Den 04-09-2013 21:03, ibad raza skrev:
>>     hello list
>>
>>     I am trying to add a mapinfo file to postgis
>>     I have tried the fwtool ogr2ogr function
>>     but the problem is that everytime I add the file, some records
>>     are missing
>>     these are the records with no geometry which do not get added in
>>     the final table
>>
>>
>>     can anyone tell me that firstlly how can I add the rows without
>>     geometry in the table as well.
>>
>>     and is there another easy way to get mapinfo file into postgis
>>
>>     Thanks
>>     Ibad Raza
>>
>>
>>     _______________________________________________
>>     Qgis-user mailing list
>>     Qgis-user at lists.osgeo.org  <mailto:Qgis-user at lists.osgeo.org>
>>     http://lists.osgeo.org/mailman/listinfo/qgis-user
>
>
>     _______________________________________________
>     Qgis-user mailing list
>     Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
>     http://lists.osgeo.org/mailman/listinfo/qgis-user
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20130905/cd6fd820/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.zip
Type: application/zip
Size: 1445 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20130905/cd6fd820/attachment.zip>


More information about the Qgis-user mailing list