nyc-lib
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
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
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
OpenLayers
<link href="https://maps.nyc.gov/nyc-lib/vX.X.X/css/nyc-ol-lib.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.4/proj4.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/openlayers/4.6.5/ol.js"></script>
<script src="https://maps.nyc.gov/nyc-lib/vX.X.X/js/nyc-ol-lib.js"></script>Leaflet
<link href="https://maps.nyc.gov/nyc-lib/vX.X.X/css/nyc-lib.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.4/proj4.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.js"></script>
<script src="https://maps.nyc.gov/nyc-lib/vX.X.X/js/nyc-leaf-lib.js"></script>Building
- Set environment variable
NODE_ENVtodev,stg, orprd - Contact author for addition evnvironment variables that should be included in your
.envfile - 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.Geoclientas the implementation ofnyc.Geocoderyou must first get your Geoclient App ID and App Key from the [NYC Developer Portal] (https://developer.cityofnewyork.us/api/geoclient-api)- 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