All Projects → austensen → geoclient

austensen / geoclient

Licence: other
R interface to NYC's Geoclient REST API

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to geoclient

nycbikemap
A web-based, unified, interactive bike map for NYC that combines information from NYC OpenData, Citi Bike and other sources.
Stars: ✭ 15 (+15.38%)
Mutual labels:  nyc
subway-time
A nice NYC Subway time table.
Stars: ✭ 25 (+92.31%)
Mutual labels:  nyc
meetup
For organizing the design systems meetup in NYC.
Stars: ✭ 23 (+76.92%)
Mutual labels:  nyc
leaflet-examples
🍁 A collection of examples of leaflet map usage
Stars: ✭ 90 (+592.31%)
Mutual labels:  geocoding
geoparser
⛔ ARCHIVED ⛔ R package for the Geoparser.io API
Stars: ✭ 38 (+192.31%)
Mutual labels:  geocoding
WhatsMissingInGeoparsing
The accompanying code and data for the Springer 2017 publication "What's missing in geographical parsing?" in Language Resources and Evaluation.
Stars: ✭ 15 (+15.38%)
Mutual labels:  geocoding
country-bounding-boxes
A list of ISO 3166-1 country codes and their bounding boxes.
Stars: ✭ 26 (+100%)
Mutual labels:  geocoding
citibike
A Node.js library for Citibike's REST API
Stars: ✭ 37 (+184.62%)
Mutual labels:  nyc
geoservices-js
Deprecated - please consider using @esri/arcgis-rest-js
Stars: ✭ 53 (+307.69%)
Mutual labels:  geocoding
maps-app-ios
Your organisation's mapping app built with the Runtime SDK for iOS
Stars: ✭ 16 (+23.08%)
Mutual labels:  geocoding
subwayclock
Display clock for NYC subways
Stars: ✭ 29 (+123.08%)
Mutual labels:  nyc
NYCOpenRecords
A web application to submit and view Freedom of Information Law requests
Stars: ✭ 38 (+192.31%)
Mutual labels:  nyc
Xponents
Geographic Place, Date/time, and Pattern entity extraction toolkit along with text extraction from unstructured data and GIS outputters.
Stars: ✭ 39 (+200%)
Mutual labels:  geocoding
article-tagging
Natural Language Processing of Chicago news articles
Stars: ✭ 41 (+215.38%)
Mutual labels:  geocoding
data-analysis-using-python
Data Analysis Using Python: A Beginner’s Guide Featuring NYC Open Data
Stars: ✭ 81 (+523.08%)
Mutual labels:  nyc
NominatimGeocoderBackend
UnifiedNlp geocoder backend that uses the OSM Nominatim service
Stars: ✭ 49 (+276.92%)
Mutual labels:  geocoding
maps-app-dotnet
Your organization's suite of cross platform mapping apps built with the ArcGIS Runtime SDK for .NET
Stars: ✭ 20 (+53.85%)
Mutual labels:  geocoding
social-data
Code and data for eviction and housing analysis in the US
Stars: ✭ 17 (+30.77%)
Mutual labels:  housing
kirby-locator
A simple map & geolocation field, built on top of open-source services and Mapbox. Kirby 3 only.
Stars: ✭ 83 (+538.46%)
Mutual labels:  geocoding
Mapnews
Today's News on a Map
Stars: ✭ 20 (+53.85%)
Mutual labels:  geocoding

geoclient

Travis-CI Build Status AppVeyor Build Status Coverage Status lifecycle

Tools to work with NYC's Geoclient REST API.

This packages uses NYC's Geoclient API but is neither endorsed nor supported by the the City of New York.

For information about the Geoclient API visit NYC's Developers Portal.

Installation

Install from Github with remotes:

# install.packages("remotes")
remotes::install_github("austensen/geoclient")

Set up Geoclient API key

You can acquire your Geoclient API Key by first registering with the NYC's API Portal, then adding a "subscription" to the Geoclient User API. Once completed, you will then be able to access your 'Primary key' at any point by visiting the NYC's API Portal and viewing your user profile.

To avoid having to provide the Key with each function call you can use geoclient_api_key() to add your Geoclient Key to your .Renviron file so they can be called securely without being stored in your code.

Basic Usage

There are 6 main location types that can be set with Geoclient: Address, BBL (Borough-Block-Lot), BIN (Building Identification Number), Blockface, Intersection, and Place ("well-known NYC place name"). All of these functions return the results of the Geoclient API call as a dataframe, with additional columns for the arguments provided to the function.

geo_address(
  house_number = "139", 
  street = "MacDougal St", 
  borough = "MN",
  zip = "10012"
)
#> # A tibble: 1 x 154
#>   input_house_num… input_street input_borough input_zip no_results
#>   <chr>            <chr>        <chr>         <chr>     <lgl>     
#> 1 139              MacDougal St manhattan     10012     FALSE     
#> # ... with 149 more variables: assemblyDistrict <chr>, bbl <chr>,
#> #   bblBoroughCode <chr>, bblTaxBlock <chr>, bblTaxLot <chr>, …

You can also pull out just a single column if that is all you need.

df <- tibble::tribble(
  ~num,  ~st,                ~boro,         ~zip,
  "139", "MacDougal St",     "manhattan",   "11231",
  "295", "Lafayette street", NA,            "10012-2722",
  "40",  "WASHINGTON SQ S",  "MN",          NA
)

dplyr::mutate(df, bbl = geo_address(num, st, boro, zip)[["bbl"]])
#> # A tibble: 3 x 5
#>   num   st               boro      zip        bbl       
#>   <chr> <chr>            <chr>     <chr>      <chr>     
#> 1 139   MacDougal St     manhattan 11231      1005430053
#> 2 295   Lafayette street <NA>      10012-2722 1005107502
#> 3 40    WASHINGTON SQ S  MN        <NA>       1005410001

For each of these location types there are two functions in this package that allow the arguments to be supplied either as individual vector, or with a dataframe and bare column names.

geo_address_data(df, num, st, boro, zip)
#> # A tibble: 3 x 241
#>   input_house_num… input_street input_borough input_zip no_results
#>   <chr>            <chr>        <chr>         <chr>     <lgl>     
#> 1 139              MacDougal St manhattan     11231     FALSE     
#> 2 295              Lafayette s… <NA>          10012-27… FALSE     
#> 3 40               WASHINGTON … manhattan     <NA>      FALSE     
#> # ... with 236 more variables: assemblyDistrict <chr>, bbl <chr>,
#> #   bblBoroughCode <chr>, bblTaxBlock <chr>, bblTaxLot <chr>, …

The return dataframe will always be the same length and in the same order, so you can easily add all the return columns to your existing dataframe.

dplyr::bind_cols(df, geo_address_data(df, num, st, boro, zip))
#> # A tibble: 3 x 245
#>   num   st    boro  zip   input_house_num… input_street input_borough
#>   <chr> <chr> <chr> <chr> <chr>            <chr>        <chr>        
#> 1 139   MacD… manh… 11231 139              MacDougal St manhattan    
#> 2 295   Lafa… <NA>  1001… 295              Lafayette s… <NA>         
#> 3 40    WASH… MN    <NA>  40               WASHINGTON … manhattan    
#> # ... with 238 more variables: input_zip <chr>, no_results <lgl>,
#> #   assemblyDistrict <chr>, bbl <chr>, bblBoroughCode <chr>, …

In addition to the 6 location types, Geoclient also provides a single-field search option, which will guess the location type. This can be particularly helpful when you have address data that is not easily separated for use with geo_address().

df <- tibble::tribble(
  ~address,
  "139 MacDougal St manhattan, 11231",
  "295 Lafayette street, 10012-2722",
  "40 WASHINGTON SQ S MN"
)

geo_search_data(df, address)
#> # A tibble: 3 x 233
#>   input_location no_results alleyCrossStree… assemblyDistrict bbl  
#>   <chr>          <lgl>      <chr>            <chr>            <chr>
#> 1 139 MacDougal… FALSE      X                55               3015…
#> 2 295 Lafayette… FALSE      X                66               1005…
#> 3 40 WASHINGTON… FALSE      <NA>             66               1005…
#> # ... with 228 more variables: bblBoroughCode <chr>, bblTaxBlock <chr>,
#> #   bblTaxLot <chr>, boardOfElectionsPreferredLgc <chr>,
#> #   boePreferredStreetName <chr>, …
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].