[OSM-dev] osm2pgsql polygon handling semantic?
Paul Norman
penorman at mac.com
Mon Oct 19 21:55:17 UTC 2015
On 10/19/2015 5:50 AM, Sven Geggus wrote:
> Hello,
>
> looking at the code of osm2pgsql and checking with a hand-crafted .osm file
> I came to the conclusion that polygons in osm2pgsql are handled in the
> following way:
>
> If a polygon is defined in the .style file a function is called which
> generates the simple-feature geometry object. If this function is unable to
> generate a polygon a linestring is created.
>
> Am I right in this assumption?
For the osm2pgsql pgsql backend, a polygon is formed when a way is
closed and the tag transform sets a polygon flag. If either of these is
false, it is a linear feature. For the C tag transforms*, the polygon
flag is set when there is a tag which has a polygon flag set, or phstore
which is equivalent to polygon,nocolumn
For the multi-backend, see
https://github.com/openstreetmap/osm2pgsql/issues/270. This issue also
contains some information about the pgsql backend.
> The reason for this question is that I'm trying to build a imposm3 style
> which will create a osm2pgsql compatible database. This has (among other
> things) the obvous advantage, that some additional tables for more exotic
> features are easy to create.
osm2pgsql has the capability to arbitrarily convert tags, for example
unit conversions, normalize yes/no/unknown values, transliterate values,
use other PostgreSQL types, and perform other logic. When I looked at
imposm3, it didn't have the capability to take a script. Has this changed?
Even if not using custom tag transforms, the osm2pgsql C tag transforms
do perform some tag manipulation.
* They still get called the C tag transforms, even though osm2pgsql is
C++ now
More information about the dev
mailing list