[Qgis-user] Strange behaviour importing data from postgis
Bo Victor Thomsen
bo.victor.thomsen at gmail.com
Mon Feb 23 23:35:06 PST 2015
Hi Igor -
Congrats on successful import of your data. When you are importing
spatial data to a database it's often a large and complicated amount and
there is always the risk of something going wrong .
Regarding the primary key:
AFAIK, QGIS needs a column with unique values in every layer for
administrative purposes (keeping track of selected records, deleted
records, edited records and so on).
This column must be a integer for traditional (i.e. I don't know why)
purposes.
If there isn't a integer primary key, QGIS initiates a search on all the
columns in a layer and chooses the most promising column for the
purpose. This can lead to erroneous situations, If the column actually
doesn't contain unique values. That's why I mentioned the blurb about
the integer primary key. It will remove a possible source for
mistakes.... And If there is a real expert on the QGIS internals reading
this mail *and* I'm wrong, then please correct me ;-)
Regards
Bo Victor Thomsen
AestasGIS
Denmark
Den 23-02-2015 kl. 22:59 skrev Igor Sosa Mayor:
> Bo Victor Thomsen
> <bo.victor.thomsen at gmail.com> writes:
>
>> Igor -
>>
>> Yes, the splitting of a table in several parts in QGIS , each
>> containing only one type of geometry objects is standard behaviour.
>>
>> A workaround is to change all your "single"-point/line/polygons to
>> multi-point/line/polygons with an update command in the postgis table.
>> I suspect there is a slight performance degradation using this method,
>> but all your rows in the table will be represented in a single layer
>> in QGIS.
>>
>> Regarding your point table:
>>
>> * Does all your records in the point table actually have point object,
>> i.e.none of the records contains NULL in the geometry column ?
>> * Is your primary key for the table an integer value ? (QGIS needs a
>> integer unique key for the table. The simplest method to ascertain
>> this is to have an integer primary key for the table.)
> Thanks again for your answer.
>
> I think I have to apologize. Maybe it was something wrong with the db. I
> deleted it, imported all the data again and it works.
>
> Nevertheless I'm a little bit confused by this question about the
> primary key. The import made by osm2psql does not create any primary key
> in the points table. However QGIS does not have any problems in
> importing the data (it seems...).
>
> In any case: thanks again for your time/help.
>
> Regards,
>
>
More information about the Qgis-user
mailing list