Giter Site home page Giter Site logo

open_places's Introduction

OpenPlaces

OpenPlaces is a Location Autocomplete Rails 4 Engine. It imports NaturalEarthData.com and Geonames.org geospatial data and provides a mountable JSON/GeoJSON API endpoint.

Requirements

Requires Postgres and PostGIS.

OpenPlaces uses Postgres and the PostGIS adapter to do fast geo-spatial and full text search. A Rails 4 application with a Postgres database with the PostGIS extension is required to use OpenPlaces.

Installation

  1. Add 'open_places' to your Gemfile and bundle install
  2. Run rake open_places:install:migrations
  3. Run rake db:migrate
  4. Mount the engine: mount OpenPlaces::Engine => "/api/geo"
  5. Restart your server

Visit: http://localhost:3000/api/geo?q=Seattle

Usage

The api endpoint is able to do a couple different operational queries

  • q= Exact Match
  • like= Fuzzy Match (using postgres ts_vector)
  • contains= Contains (LIKE '%?%')
  • starts= Starts with (LIKE '?%')
  • ends= Ends with (LIKE '%?')

Additionally, it will take a near param, a latitude,longitude string. With a near param, a distance attribute is added and the results are ordered by population, distance, and ts_rank if the operational query is like.

Data Structure

OpenPlaces includes a rake task to build a single database table of normalized data. For convenience, a 12Mb CSV file is included for fast import. The data includes the following fields:

  • geo_type
    • subtype
    • scalerank
  • code
  • name
  • long_name
  • country
  • country_code
  • province
  • province_code
    • continent
    • region_un
    • subregion
    • region_wb
  • latitude
  • longitude
    • x_min
    • y_min
    • x_max
    • area

Data Sources

OpenPlaces imports Countries, States/Provinces, Cities, National Parks, Lakes and Rivers from Natural EarthData.com and Geonames.org.

Total Records

  • 255 Countries
  • 4516 States/Provinces
  • 146474 Places (Metros/Cities/Towns)
  • 61 US National Parks
  • 743 Lakes
  • 1454 Rivers

open_places's People

Contributors

tyrauber avatar

Watchers

 avatar James Cloos avatar Pedro Carmona 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.