Giter Site home page Giter Site logo

cleartables's Introduction

ClearTables

An osm2pgsql multi-backend style designed to simplify consumption of OSM data for rendering, export, or analysis.

ClearTables is currently under rapid development, and schema changes will frequently require database reloads.

Requirements

  • osm2pgsql 0.88.0 or later. The multi-backend is used, which 0.86.0 does not support.
  • Lua, required for both osm2pgsql and testing the transforms
  • PostgreSQL 9.1 or later
  • PostGIS 2.0 or later
  • Python with PyYAML
  • Make. Any version of Make should work, or the commands are simple enough to run by hand.

Usage

make
createdb <database>
psql -d <database> -c 'CREATE EXTENSION postgis;'
cat sql/types/*.sql | psql -1Xq -d <database>
osm2pgsql -d <database> --output multi --style cleartables.json extract.osm.pbf

Principles

These are still a bit vague, and might be split into principles and practices

  • Simplify data for the consumer

  • Use PostgreSQL types other than text if appropriate

  • Use boolean for yes/no values

  • Use enum types where there's a defined list of possibilities

FAQ

Why no addresses in the building table?

Addresses and buildings have a many-to-many relationship. Multiple addresses inside one building are very common, and multiple buildings in one address can be found. If rendering, a separate table is fine, and if doing an analysis these cases need to be considered which requires joins.

Contributing

Bug reports, suggestions and (especially!) pull requests are very welcome on the Github issue tracker. Please check the tracker to see if your issue is already known, and be nice. For questions, please use IRC (irc.oftc.net or http://irc.osm.org, channel #osm-dev) and http://help.osm.org.

If you'd like to sponsor development of ClearTables or a multi-backend style for your needs, you can contact me at [email protected].

Code style

  • 2sp for YAML, 4sp for Lua
  • tags are OSM tags, cols are database columns
  • Space after function name when defining a function, e.g. ``function f (args)`
  • Tests for all Lua functions except ones which are only tail calls

Lua tricks

  • Tag acceptance functions need to exit quickly in the common case of possible match

  • Always set columns to strings, even if they're only true/false. It's unwise to count on anything else making it from Lua to C to C++ to PostgreSQL. This lets PostgreSQL do the only coversion.

Additional Reading

cleartables's People

Contributors

pnorman avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.