geolite
making openstreetmap data usable by anyone: from .osm.pbf to the first query answer.
open source geocode
getting started
with cargo
with docker
# command line
# pre-built geocoder of a continent
# open http://localhost:8080
docs
docker images
base image
pre-built images
size matters: once a region's data grows too large for a docker image, its pre-built image stops being updated and may be dropped.
# open http://localhost:8080
available images
the images are rebuilt on the 1st and the 15th of every month from the latest geofabrik extracts; the dated tag keeps each build.
| # | region | docker cmd |
|---|---|---|
| 1 | south-america, one base per country, thirteen in all | docker run -p 8080:8080 pjpimentel/geolite:prebuilt-south-america |
| 2 | portugal | docker run -p 8080:8080 pjpimentel/geolite:prebuilt-portugal |
| 3 | netherlands | docker run -p 8080:8080 pjpimentel/geolite:prebuilt-netherlands |
| 4 | switzerland | docker run -p 8080:8080 pjpimentel/geolite:prebuilt-switzerland |
cookbook
execute all necessary steps
# or with docker
extract each data from a pbf file
# the two extraction stages read everything the osm data holds, every pbf decoded so far
index extracted data
# every base of the data path, or the ones named: `geolite exec index-addresses br`
optimize data
# deletes a country without children and a street without parents, then folds the ways of one
# street into one row: both read the hierarchy and clear the addresses and coordinates indexes,
# which have to be built again after them
geolite exec runs one stage per call and refuses a stage whose requirements did not run, naming
the one to run first; geolite exec --help lists the stages in the order the pipeline runs. a stage
that reads a pbf names it (extract-osm-pbf-data brazil); the two extraction stages read everything
the osm data holds; a stage that works on the bases runs over every base of the data path, or over
the countries named (index-addresses br ar).
geolite build runs optimize-delete-isolated-admin-levels, which removes a base it leaves empty,
and optimize-merge-admin-levels right after index-admin-levels-hierarchy, so the two other
indexes are built once, over the rows that stay. no index stage deletes or folds on its own.
query
explore
run the end-to-end suite
question and answers
a) why geolite?
"geo" comes from "geocode" and "lite" comes from "sqlite", no special meaning.
b) where does the data come from?
the data comes from any .osm.pbf file (openstreetmap's protobuffer format). this project uses geofabrik as the initial source, which extracts its data from openstreetmap.
c) which license applies?
the source code is under agplv3 and its dependencies keep their own (all permissive: mit, apache-2.0, bsd, zlib, isc). databases built from openstreetmap data — including the ones shipped in the prebuilt-* images — are derivative databases under the odbl, filtered and restructured for geocoding: © openstreetmap contributors.
d) why build another geocoder?
two reasons, in this order: to practice rust on a problem large enough to be interesting, and because the alternatives i tried were a bit too complex for a quick run.