npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@conveyal/geocoder-arcgis-geojson

v0.0.3

Published

Return argis geocode results as geojson

Downloads

2,912

Readme

geocoder-arcgis-geojson

Isomorphic geocoding for reuse across our JavaScript libraries. This library is built to match the API of geocoder-arcgis in order to facilitate a quick conversion of our applications to use ESRI's geocoder. Read the ESRI docs here. Coordinates must be anything that can be parsed by lonlng.

Examples

All API methods (except autocomplete) accept the options clientId, clientSecret and forStorage. When using forStorage, the clientId and clientSecret options are required.

Autocomplete

import {autocomplete} from 'geocoder-arcgis-geojson'

autocomplete({
  boundary: {
    rect: {
      minLon: minLon,
      minLat: minLat,
      maxLon: maxLon,
      maxLat: maxLat
    }
  },
  focusPoint: {lat: 39.7691, lon: -86.1570},
  text: '1301 U Str'
}).then((result) => {
  console.log(result)
}).catch((err) => {
  console.error(err)
})

Bulk

import {autocomplete} from 'geocoder-arcgis-geojson'

bulk({
  addresses: [
    '1301 U Str',
    '123 Main St'
  ],
  boundary: {
    rect: {
      minLon: minLon,
      minLat: minLat,
      maxLon: maxLon,
      maxLat: maxLat
    }
  },
  clientId: 'secret',
  clientSecret: 'secret',
  focusPoint: {lat: 39.7691, lon: -86.1570}
}).then((result) => {
  console.log(result)
}).catch((err) => {
  console.error(err)
})

Reverse

import {reverse} from 'geocoder-arcgis-geojson'

reverse({
  point: {
    lat: 39.7691,
    lng: -86.1570
  }
}).then((result) => {
  console.log(result)
}).catch((err) => {
  console.error(err)
})

search({apiKey, text, ...options})

import {search} from 'geocoder-arcgis-geojson'

search({
  text: '1301 U Street NW, Washington, DC',
  focusPoint: {lat: 39.7691, lon: -86.1570},
  boundary: {
    rect: {
      minLon: minLon,
      minLat: minLat,
      maxLon: maxLon,
      maxLat: maxLat
    }
  }
}).then((geojson) => {
  console.log(geojson)
}).catch((err) => {
  console.error(err)
})

API

Table of Contents

autocomplete

index.js:94-128

Search for and address using ESRI's suggest service. This service does not return geojson, instead it returns the list of address suggestions and corresponding magicKeys

Parameters

Returns Promise A Promise that'll get resolved with the suggest result

bulk

index.js:144-195

Bulk geocode a list of addresses using ESRI's geocodeAddresses service.

Parameters

  • $0 Object
    • $0.addresses Array Can be array of strings or objects. Strings can be addresses or coordinates in the form lon,lat
    • $0.clientId string
    • $0.clientSecret string
    • $0.boundary Object?
    • $0.focusPoint Object?
    • $0.url string?

Returns Promise A Promise that'll get resolved with the bulk geocode result

reverse

index.js:210-251

Reverse geocode using ESRI's reverseGeocode service.

Parameters

  • $0 Object
    • $0.clientId string?
    • $0.clientSecret string?
    • $0.forStorage boolean Specifies whether result is inteded to be stored (optional, default false)
    • $0.point {lat: number, lon: number} Point to reverse geocode
    • $0.url string? optional URL to override ESRI reverseGeocode endpoint

Returns Promise A Promise that'll get resolved with reverse geocode result

search

index.js:270-324

Search for an address using ESRI's findAddressCandidates service.

Parameters

  • $0 Object
    • $0.clientId string?
    • $0.clientSecret string?
    • $0.boundary Object?
    • $0.focusPoint Object?
    • $0.forStorage boolean Specifies whether result is inteded to be stored (optional, default false)
    • $0.magicKey string? magicKey to use in searching as obtained from suggest results
    • $0.size number (optional, default 10)
    • $0.text string The address text to query for
    • $0.url string? optional URL to override ESRI reverseGeocode endpoint

Returns Promise A Promise that'll get resolved with search result