Book Image

PostGIS Cookbook

Book Image

PostGIS Cookbook

Overview of this book

Table of Contents (18 chapters)
PostGIS Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Loading data from OpenStreetMap and finding the shortest path using A*


Test data are great for understanding how algorithms work, but the real data is often more interesting. A good source for real data worldwide is OpenStreetMap (OSM), a worldwide, wiki-style geospatial dataset. What is wonderful about using OSM in conjunction with pgRouting is that it is inherently a topological model, meaning that it follows the same kinds of rules in its construction that we do in graph traversal within pgRouting. Because of how editing and community participation works in OSM, it is often an equally good or better data source than commercial ones and, of course, quite compatible with our open source model.

Another great feature is that there is a free and open source software to ingest OSM data and import it into a routing database— osm2pgrouting.

Getting ready

It is recommended to either get the downloadable files from http://metro.teczno.com, or download the example dataset that we have provided, available...