Skip to content
Data for machine learning with OpenStreetMap
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Spatial Current Machine Learning Guide (sc-ml-guide)


A guide for machine learning with Internet-scale geospatial data. This guide includes information on classifiers and training datasets for parsing and understanding large geospatial datsets, including OpenStreetMap.


Many of the examples in this guide use the Python Natural Language Toolkit (NLTK) for machine learning tasks.


Spatial Current, Inc. is currently accepting pull requests for this repository. We'd love to have your contributions! Please see for how to get started.


This work is distributed under the MIT License. See LICENSE file.


This guide includes a list of classifiers and how they can be used.

Naive Bayes Classifier

A naive Bayes classifier can be used for simple categorizing of a set of documents. A simple use case is using 2 related attributes of geospatial features to fill in sparse data, e.g., type of cuisine.


For python, Python Natural Language Toolkit (NLTK) is a great tool that has a naive Bayes classifier. See Chapter 6, Section 1.3 of the Natural Language Processing with Python online book.

For Java, see the Java-Naive-Bayes-Classifier, including the runnable example.


Below is a sample workflow with some pseudo-code.

  • Collect training dataset, e.g., OSM extract or Spatial Current SGOL query.
  • Generate frequency distribution of words
  • Create vocabulary (select top N most common words from the frequency distribution)
  • For each document in a training dataset, convert into a series of binary contains(<word>) features
  • Train dataset
  • Convert input into document
  • Classify document, e.g., category = classifier.classify(convert(document)).


See the data.yml file in /data/naive-bayes-classifier folder for bootstrapping a classifier to guess the cuisine of a point of interest, based on the name.

Training Datasets


This dataset includes a list of amenities in Washington, DC and Virginia that have name= and cuisine= tags.

You can’t perform that action at this time.