X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/9321e425a4b6a42f8c6579a27f575d40a07efa12..9a84adef5981d1a8357fd1775358742aae83867b:/docs/customize/Import-Styles.md?ds=sidebyside diff --git a/docs/customize/Import-Styles.md b/docs/customize/Import-Styles.md index 1f171c16..e96f96e0 100644 --- a/docs/customize/Import-Styles.md +++ b/docs/customize/Import-Styles.md @@ -49,7 +49,9 @@ during the processing. There are no built-in defaults for the tag lists, so all the functions need to be called from your style script to fully process the data. Make sure you start from one of the default style and only modify - the data you are interested in. + the data you are interested in. You can also derive your style from an + existing style by importing the appropriate module, e.g. + `local flex = require('import-street')`. Many of the following functions take _key match lists_. These lists can contain three kinds of strings to match against tag keys: @@ -91,10 +93,12 @@ key, then this is used as default for values that are not listed. !!! example ``` lua + local flex = require('import-full') + flex.set_main_tags{ - boundary = {'administrative' = named}, - highway = {'always', street_lamp = 'named'} - landuse = 'fallback', + boundary = {administrative = 'named'}, + highway = {'always', street_lamp = 'named'}, + landuse = 'fallback' } ``` @@ -123,7 +127,7 @@ to the user when requested, but are not used otherwise. values. Tags with matching key/value pairs are deleted. * __extra_keys__ is a _key match list_ for tags which should be saved into extratags -* __delete_tags__ contains a table of tag keys pointing to a list of tag +* __extra_tags__ contains a table of tag keys pointing to a list of tag values. Tags with matching key/value pairs are moved to extratags. Key list may contain three kinds of strings: @@ -134,9 +138,11 @@ Any other string is matched exactly against tag keys. !!! example ``` lua + local flex = require('import-full') + flex.set_prefilters{ delete_keys = {'source', 'source:*'}, - extra_tags = {'amenity' = {'yes', 'no'} + extra_tags = {amenity = {'yes', 'no'}} } flex.set_main_tags{ amenity = 'always' @@ -168,7 +174,9 @@ They take _key match lists_ for main and extra names respectively. !!! example ``` lua - flex.set_main_tags{'highway' = {'traffic_light' = 'named'}} + local flex = require('flex-base') + + flex.set_main_tags{highway = {traffic_light = 'named'}} flex.set_name_tags{main = {'name', 'name:*'}, extra = {'ref'} } @@ -185,14 +193,14 @@ Address tags will be used to build up the address of an object. `set_address_tags()` takes a table with arbitrary fields pointing to _key match lists_. To fields have a special meaning: -__main__ defines +* __main__: defines the tags that make a full address object out of the OSM object. This is usually the housenumber or variants thereof. If a main address tag appears, then the object will always be included, if necessary with a fallback of `place=house`. If the key has a prefix of `addr:` or `is_in:` this will be stripped. -__extra__ defines all supplementary tags for addresses, tags like `addr:street`, `addr:city` etc. If the key has a prefix of `addr:` or `is_in:` this will be stripped. +* __extra__: defines all supplementary tags for addresses, tags like `addr:street`, `addr:city` etc. If the key has a prefix of `addr:` or `is_in:` this will be stripped. All other fields will be handled as summary fields. If a key matches the key match list, then its value will be added to the address tags with the @@ -204,6 +212,8 @@ are accepted, all other values are discarded. !!! example ``` lua + local flex = require('import-full') + flex.set_address_tags{ main = {'addr:housenumber'}, extra = {'addr:*'}, @@ -239,6 +249,8 @@ above. !!! example ``` lua + local flex = require('import-full') + flex.set_address_tags{ main = {'addr:housenumber'}, extra = {'addr:*', 'tiger:county'} @@ -274,6 +286,8 @@ kinds of geometries can be used: !!! Example ``` lua + local flex = require('import-full') + flex.RELATION_TYPES['site'] = flex.relation_as_multipolygon ``` @@ -292,6 +306,8 @@ logic. !!! Example ``` lua + local flex = require('import-full') + function osm2pgsql.process_relation(object) if object.tags.boundary ~= 'administrative' or object.tags.admin_level ~= '2' then flex.process_relation(object) @@ -312,6 +328,8 @@ responsible for filtering the tags and writing out the rows into Postgresql. !!! Example ``` lua + local flex = require('import-full') + local original_process_tags = flex.process_tags function flex.process_tags(o)