[Qgis-user] mapinfo file to postgis

Bo Victor Thomsen bo.victor.thomsen at gmail.com
Wed Sep 4 14:49:58 PDT 2013


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
> http://lists.osgeo.org/mailman/listinfo/qgis-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20130904/e505962a/attachment.html>


More information about the Qgis-user mailing list