Skip to content

Commit 4d0299a

Browse files
committed
osm2pgsql-expire: Expire type=boundary relations as multipolygons
You can always use --mode=boundary_only to switch back to boundary only interepretation. So type=boundary is now treated exactly like type=multipolygon. Also adds more information to man page.
1 parent 69a53b1 commit 4d0299a

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

man/osm2pgsql-expire.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ The expire command can be used for two things:
1616
1. **To check what tiles some OSM data is in.** If an *OSM-FILE* is specified
1717
osm2pgsql-expire will calculate the tiles covering the objects in that file.
1818
Note that the file must not be a change file but a regular OSM data file!
19-
Output is, by default, a tile file, but GeoJSON is also possible.
19+
Output is, by default, a tile file, but GeoJSON is also possible.Covering
20+
tiles are only calculated for tagged objects.
2021
2. **Visualize tile list.** If a *TILE-FILE* (presumably generated by osm2pgsql)
2122
is specified, a GeoJSON file is generated showing all mentioned tiles. In
2223
this mode all command line options are ignored.
@@ -25,6 +26,25 @@ Read the *Expire* chapter of the osm2pgsql manual
2526
(https://osm2pgsql.org/doc/manual.html#expire) for details on how to
2627
interpret the `-m, \--mode` and `\--full-area-limit` options.
2728

29+
# GEOMETRY GENERATION
30+
31+
To calculate the tiles covering the specified OSM data in mode (1), a geometry
32+
has to be generated first for each object. This works as follow:
33+
34+
* For nodes a point geometry will be generated.
35+
* For closed ways a polygon geometry will be generated, for non-closed ways
36+
a linestring geometry. If a generated polygon is not valid, the program
37+
will fall back to a linestring. If neither a valid polygon nor a valid
38+
linestring can be generated the object is ignored.
39+
* For relations a geometry is generated based on the `type` tag. For types
40+
`multipolygon` and `boundary`, a multipolygon geometry is created, for types
41+
`route` and `multilinestring` a multilinestring geometry is created, for
42+
all other types a geometry collection is created.
43+
44+
Note that for (multi)polygons it depends on the command line options \--mode
45+
and \--full-area-limit whether the tiles calculation is based on the area or
46+
the boundary of the (multi)polygons.
47+
2848
# OPTIONS
2949

3050
This program follows the usual GNU command line syntax, with long options

src/osm2pgsql-expire.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ void output_expire_t::relation_add(osmium::Relation const &relation)
189189
osmium::memory::Buffer tmp_buffer{1024,
190190
osmium::memory::Buffer::auto_grow::yes};
191191
geom::geometry_t geom;
192-
if (type == "multipolygon") {
192+
if (type == "multipolygon" || type == "boundary") {
193193
log_debug("Creating multipolygon from relation {}...", relation.id());
194194
geom::create_multipolygon(&geom, relation, buffer, &tmp_buffer);
195195
} else if (type == "route" || type == "multilinestring") {

0 commit comments

Comments
 (0)