Skip to content

Commit 388a52b

Browse files
committed
Document deleted callbacks
1 parent 8ee4065 commit 388a52b

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

_manual-v2/06-flex-output.md

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,8 @@ example config file.
435435

436436
### Processing Callbacks
437437

438-
You are expected to define one or more of the following functions:
438+
You are expected to define one or more of the following functions. Each defines
439+
how osm2pgsql is supposed to handle specific types of objects.
439440

440441
| Callback function | Description |
441442
| ----------------------------------------------- | ------------------------------------------------- |
@@ -445,6 +446,9 @@ You are expected to define one or more of the following functions:
445446
| osm2pgsql.**process_untagged_node**(object) | Called for each new or changed untagged node. |
446447
| osm2pgsql.**process_untagged_way**(object) | Called for each new or changed untagged way. |
447448
| osm2pgsql.**process_untagged_relation**(object) | Called for each new or changed untagged relation. |
449+
| osm2pgsql.**process_deleted_node**(object) | *Version >= 2.2.0*{:.version} Called for each deleted node. |
450+
| osm2pgsql.**process_deleted_way**(object) | *Version >= 2.2.0*{:.version} Called for each deleted way. |
451+
| osm2pgsql.**process_deleted_relation**(object) | *Version >= 2.2.0*{:.version} Called for each deleted relation. |
448452
{: .desc}
449453

450454
They all have a single argument of type table (here called `object`) and no
@@ -453,15 +457,21 @@ to supply all the functions.
453457

454458
Usually you are only interested in tagged objects, i.e. OSM objects that have
455459
at least one tag, so you will only define one or more of the first three
456-
functions. But if you are interested in untagged objects also, define the
457-
last three functions. If you want to have the same behaviour for untagged
458-
and tagged objects, you can define the functions to be the same.
460+
functions. But if you are interested in untagged objects also, define one or
461+
more of the `process_untagged_*` functions. If you want to have the same
462+
behaviour for untagged and tagged objects, you can define the functions to be
463+
the same.
459464

460-
These functions are called for each new or modified OSM object in the input
461-
file. No function is called for deleted objects, osm2pgsql will automatically
462-
delete all data in your database tables that were derived from deleted objects.
463-
Modifications are handled as deletions followed by creation of a "new" object,
464-
for which the functions are called.
465+
One of the first six functions is called for each new or modified OSM object in
466+
the input file. Usually you don't need to think about deleted objects, because
467+
osm2pgsql will automatically delete all data in your database tables that were
468+
derived from deleted objects. Modifications are handled as deletions followed
469+
by creation of a "new" object, for which the functions are called.
470+
471+
*Version < 2.2.0*{:.version} No function is called for deleted objects.
472+
473+
*Version >= 2.2.0*{:.version} The `process_deleted_*` functions are called
474+
for actually deleted objects (not for changed objects).
465475

466476
You can do anything in those processing functions to decide what to do with
467477
this data. If you are not interested in that OSM object, simply return from the
@@ -499,6 +509,11 @@ When handling updates they are only included if the middle table contain this
499509
data (i.e. when `-x|--extra-attributes` option was used).
500510
{: .table-note}
501511

512+
*Version >= 2.2.0*{:.version} In the `process_deleted_*` callbacks, the object
513+
will only have the `.type` and `.id` fields and possibly the `.version`,
514+
`.timestamp`, `.changeset`, `.uid`, and `.user` fields. None of the functions
515+
are available.
516+
502517
The `as_*` functions will return a NULL geometry if
503518
the geometry can not be created for some reason, for instance a polygon can
504519
only be created from closed ways. This can also happen if your input data is
@@ -512,10 +527,10 @@ The `as_multipoint()` function can be used on nodes and relations. For nodes it
512527
will always return a point geometry, for relations a point or multipoint
513528
geometry with all available node members.
514529

515-
The `as_multilinestring()` and `as_multipolygon()` functions, on the other
516-
hand, can be used for ways and for relations. The latter will either return
517-
a linestring/polygon or a multilinestring/multipolygon, depending on whether
518-
the result is a single geometry or a multi-geometry.
530+
The `as_multilinestring()` and `as_multipolygon()` functions can be used for
531+
ways and for relations. The latter will either return a linestring/polygon or a
532+
multilinestring/multipolygon, depending on whether the result is a single
533+
geometry or a multi-geometry.
519534

520535
If you need all geometries of a relation, you can use
521536
`as_geometrycollection()`. It will contain all geometries which can be

0 commit comments

Comments
 (0)