Giter Club home page Giter Club logo

photon's Introduction

R Interface to the Photon API

Photon is an open source geocoder built for OpenStreetMap data and based on elasticsearch. This package allows to query a photon API and get the results in a data frame.

Photon web site: http://photon.komoot.de/
Photon source code: https://github.com/komoot/photon

Install Instructions

require(devtools)  
devtools::install_github(repo = 'rCarto/photon')  

Usage

geocode()

address <- c("19 rue Michel Bakounine, 29600 Morlaix, France",
             "5 rue Proudhon, 34130 Mauguio France",
             "2 Emma Goldmanweg, Tilburg, Netherlands",
             "36 Strada Panait Israti, Bucarest, Romania")
place <- geocode(address, limit = 1, key = "place")
place
location osm_id osm_type name housenumber street postcode city state country osm_key osm_value lon lat msg
19 rue Michel Bakounine, 29600 Morlaix, France 3241060871 N NA 19 Rue Michel Bakounine 29600 Morlaix Brittany France place house -3.816435 48.59041 NA
5 rue Proudhon, 34130 Mauguio France 3700168030 N NA 5 Rue Proudhon 34130 Mauguio Occitania France place house 4.008024 43.61583 NA
2 Emma Goldmanweg, Tilburg, Netherlands 2844596196 N NA 2 Emma Goldmanweg 5032MN Tilburg North Brabant The Netherlands place house 5.041361 51.53783 NA
36 Strada Panait Israti, Bucarest, Romania 2838254765 N NA 36 Strada Panait Istrati 011547 Bucharest NA Romania place house 26.064266 44.46227 NA
geocode("Montreuil", limit = 1)
location osm_id osm_type name housenumber street postcode city state country osm_key osm_value lon lat msg
Montreuil 2622231 R Montreuil NA NA 62170 NA Nord-Pas-de-Calais and Picardy France place village 1.764228 50.46375 NA
geocode("Montreuil", locbias = c(2.4, 48.9), limit = 1)
location osm_id osm_type name housenumber street postcode city state country osm_key osm_value lon lat msg
Montreuil 129423 R Montreuil NA NA 93100 NA Ile-de-France France place city 2.441218 48.86234 NA
# with a typical local install of photon
place <- geocode(address, limit = 1, key = "place", server = "http://0.0.0.0:2322/")

reverse()

address <- c("19 rue Michel Bakounine, 29600 Morlaix, France",
             "5 rue Proudhon, 34130 Mauguio France",
             "2 Emma Goldmanweg, Tilburg, Netherlands",
             "36 Strada Panait Israti, Bucarest, Romania")
place <- geocode(address, limit = 1, key = "place")
place2 <- reverse(x = place$lon, y = place$lat)
place2
x y osm_id osm_type name housenumber street postcode city state country osm_key osm_value lon lat msg
-3.816435 48.59041 3241060871 N NA 19 Rue Michel Bakounine 29600 Morlaix Brittany France place house -3.816435 48.59041 NA
4.008024 43.61583 3700168030 N NA 5 Rue Proudhon 34130 Mauguio Occitania France place house 4.008024 43.61583 NA
5.041361 51.53783 2844596196 N NA 2 Emma Goldmanweg 5032MN Tilburg North Brabant The Netherlands place house 5.041361 51.53783 NA
26.064266 44.46227 2838254765 N NA 36 Strada Panait Istrati 011547 Bucharest NA Romania place house 26.064266 44.46227 NA
identical(place[,2:12], place2[,3:13])
>TRUE

photon's People

Contributors

rcarto avatar rcura avatar

Watchers

Ayeshmantha Perera 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.