index
- Data Stores¶
The index
submodule provides efficient storage containers for
preprocessed OSM data.
Node Location Storage¶
Node location can be cached in a LocationTable
. There are different
implementations available which should be choosen according to the size of
data and whether or not the cache should be permanent. See the Osmium manual
for a detailed explaination. The compiled in types can be listed with the
map_types
function, new stores can be created with create_map
.
-
osmium.index.
map_types
() → object :¶ Return a list of strings with valid types for the location table.
-
osmium.index.
create_map
((str)map_type) → LocationTable :¶ Create a new location store. The string parameter takes the type and, where required, additional arguments separated by comma. For example, to create an array cache backed by a file
foo.store
, the map_type should bedense_file_array,foo.store
.
-
class
osmium.index.
LocationTable
¶ A map from a node ID to a location object. This implementation works only with positive node IDs.
-
clear
((LocationTable)self) → None :¶ Remove all entries from the location table.
-
get
((LocationTable)self, (int)id) → Location :¶ Return the location for a given id.
-
set
((LocationTable)self, (int)id, (Location)loc) → None :¶ Set the location for a given node id.
-
used_memory
((LocationTable)self) → int :¶ Return the size (in bytes) currently allocated by this location table.
-