npm.io
1.4.89 • Published 2 years ago

nyc-lib

Licence
Apache-2.0
Version
1.4.89
Deps
10
Size
10.2 MB
Vulns
0
Weekly
0
Stars
12
Install scriptsThis package runs scripts during installation (preinstall/install/postinstall)

nyc-lib

Build Status Coverage Status

GitHub Repo

nyc-lib is a set of common libraries used to develop NYC mapping applications

Documentation and Examples

Using with Node.js
  • yarn add nyc-lib && yarn global add postcss-cli
Required external dependencies

The following libraries are extenal requiremnents that must be included separately in your build or in your HTML page:

  • proj4
  • ol
  • jquery
Optional external dependencies

The following libraries are extenal requiremnents that may be optionally included separately depending on desired functionality:

  • shapefile
  • papaparse
  • leaflet
Adding to package.json
{
  ...
  "dependencies: {
    ...
    "nyc-lib": "^@@VERSION@@"
    ...
  }
  ...
}
Using in an HTML page

Note: If you plan on load testing an application that uses this library you must do so using a staging URL provided by the DoITT GIS Unit

<link href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.5.0/css/ol.css" rel="stylesheet">
<link href="https://maps.nyc.gov/nyc-lib/@@VERSION@@/css/nyc-ol-lib.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.4/proj4.js"></script>
<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v7.1.0/build/ol.js"></script>
<script src="https://maps.nyc.gov/nyc-lib/@@VERSION@@/js/nyc-ol-lib.js"></script>
Building
  • Set environment variable NODE_ENV to dev, stg, or prd
  • Until webpack and dependencies are upgraded export NODE_OPTIONS=--openssl-legacy-provider
  • If you plan on load testing an application that uses this library you must do so using a staging build
  • Once the environment is set run yarn build
Geocoding
  • To use nyc.Geoclient as the implementation of nyc.Geocoder you must first get your Geoclient App ID and App Key from the NYC Developer Portal
    • Register if you don't have an NYC Developer Portal account
    • Developer Management > View or Create a New Project...
  • If you work for NYC you may contect the DoITT GIS unit for your App ID and App Key to use a DoITT hosted and supported version of Geoclient