[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] OSM post import questions
From:       Imre Samu <pella.samu () gmail ! com>
Date:       2015-11-23 21:40:10
Message-ID: CAJnEWwnMd0x5-mzR7PGS6PK3b9-_nVyg9rScyYWNMwZ2jxS77w () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Tom,

> osm_id field contains non-unique values as well as negative values

This is normal.   Osm2pgsql optimised for rendering.
- The osm2pgsql program now  spliting long ways after around 1 degree or
100km

https://github.com/openstreetmap/osm2pgsql/search?utf8=%E2%9C%93&q=Split+long+ways

- "--multi-geometry (-G) is necessary for most analysis as it prevents
MULTIPOLYGONs from being split into multiple POLYGONs ..."
https://github.com/openstreetmap/osm2pgsql/blob/master/docs/analysis.md

- negative values:   relations

https://help.openstreetmap.org/questions/2259/is-there-a-reason-why-osm2pgsql-produces-negative-osm_id-values


The easy solution for a primary key :    ALTER TABLE tablename ADD COLUMN
gid SERIAL UNIQUE;
(from https://github.com/openstreetmap/osm2pgsql/issues/446 )

Regards,
 Imre


2015-11-23 20:23 GMT+01:00 Thomas Endres <endres.thomas@gmail.com>:

> Hi,
> I have a couple post-import questions regarding North America osm data -
> hoping someone can help.
> Using the following with Postgres 9.4.5 and PostGIS 2.2 on an ubuntu
> instance.
> 
> osm2pgsql --create --slim --cache 14000 --number-processes 4 --hstore -d
> osm --flat-nodes /usr/local/osm/flat_nodes.bin --style
> /usr/local/osm/default.style --multi-geometry
> /tmp/north-america-latest.osm.pbf
> 
> 1- I'm trying to add a primary key on a few tables (on the osm_id field)
> for use in QGIS.  Problem is the planet_osm_line table for example errors
> as the osm_id field contains non-unique values as well as negative
> values.(?)
> Is the slim mode or flat-nodes causing me problems?
> 
> 2- Should I have used the -l switch on import for epsg:4326 - I used
> nothing and assumed it would default to 900913?
> 
> Thanks!
> -tom
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/postgis-users
> 


[Attachment #5 (text/html)]

<div dir="ltr">Hi Tom,<div><br></div><div>&gt;<span style="font-size:12.8px">  \
</span><span style="font-size:12.8px">osm_id field contains non-unique values as well \
as negative values</span></div><div><br></div><div>This is normal.    Osm2pgsql \
optimised for rendering.   </div><div>- The osm2pgsql program now   spliting long \
ways after around 1 degree or 100km<br>   <a \
href="https://github.com/openstreetmap/osm2pgsql/search?utf8=%E2%9C%93&amp;q=Split+lon \
g+ways">https://github.com/openstreetmap/osm2pgsql/search?utf8=%E2%9C%93&amp;q=Split+long+ways</a></div><div><br></div><div>- \
&quot;--multi-geometry (-G) is necessary for most analysis as it prevents \
MULTIPOLYGONs from being split into multiple POLYGONs ...&quot;     <a \
href="https://github.com/openstreetmap/osm2pgsql/blob/master/docs/analysis.md">https:/ \
/github.com/openstreetmap/osm2pgsql/blob/master/docs/analysis.md</a></div><div><br></div><div>- \
negative values:    relations</div><div>   <a \
href="https://help.openstreetmap.org/questions/2259/is-there-a-reason-why-osm2pgsql-pr \
oduces-negative-osm_id-values">https://help.openstreetmap.org/questions/2259/is-there- \
a-reason-why-osm2pgsql-produces-negative-osm_id-values</a><br></div><div><br></div><div>The \
easy solution for a <span style="font-size:12.8px">primary key :     </span><span \
style="color:rgb(51,51,51);font-family:Consolas,&#39;Liberation \
Mono&#39;,Menlo,Courier,monospace;font-size:11.9px;line-height:inherit;background-color:transparent"> \
ALTER TABLE tablename ADD COLUMN gid SERIAL UNIQUE;</span></div><div>(from <a \
href="https://github.com/openstreetmap/osm2pgsql/issues/446">https://github.com/openstreetmap/osm2pgsql/issues/446</a> \
)<br></div><div><br></div><div><span \
style="font-size:12.8px">Regards,</span></div><div><span style="font-size:12.8px">  \
Imre</span></div><div><br></div></div><div class="gmail_extra"><br><div \
class="gmail_quote">2015-11-23 20:23 GMT+01:00 Thomas Endres <span dir="ltr">&lt;<a \
href="mailto:endres.thomas@gmail.com" \
target="_blank">endres.thomas@gmail.com</a>&gt;</span>:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"><div>Hi,</div><div>I have a couple post-import \
questions regarding North America osm data - hoping someone can help.</div><div>Using \
the following with Postgres 9.4.5 and PostGIS 2.2 on an ubuntu \
instance.</div><div><br></div><div>osm2pgsql --create --slim --cache 14000 \
--number-processes 4 --hstore -d osm --flat-nodes /usr/local/osm/flat_nodes.bin \
--style /usr/local/osm/default.style --multi-geometry \
/tmp/north-america-latest.osm.pbf</div><div><br></div><div>1- I&#39;m trying to add a \
primary key on a few tables (on the osm_id field) for use in QGIS.   Problem is the \
planet_osm_line table for example errors as the osm_id field contains non-unique \
values as well as negative values.(?)</div><div>Is the slim mode or flat-nodes \
causing me problems?</div><div><br></div><div>2- Should I have used the -l switch on \
import for epsg:4326 - I used nothing and assumed it would default to \
900913?</div><div><br></div><div>Thanks!</div><div>-tom</div></div> \
<br>_______________________________________________<br> postgis-users mailing \
list<br> <a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
 <a href="http://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" \
target="_blank">http://lists.osgeo.org/mailman/listinfo/postgis-users</a><br></blockquote></div><br></div>



[Attachment #6 (text/plain)]

_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/postgis-users

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic