To install:
- Clone this gist as a git repo
npm installin itnode index.js
| var querystring = require('querystring'); | |
| var merc = new (require('sphericalmercator'))(); | |
| // customize this point - these are longitude, latitude coordinates | |
| var projected = merc.forward([ | |
| -106.48223736908858, | |
| 35.02338757234806]); | |
| var point = { | |
| x: projected[0], | |
| y: projected[1], | |
| spatialReference: { | |
| wkid:102100 | |
| } | |
| }; | |
| var q = { | |
| f: 'json', | |
| geometry: JSON.stringify(point), | |
| tolerance: '3', | |
| returnGeometry: 'true', | |
| mapExtent: '{"xmin":-11869218.033253865,"ymin":4141606.3456870574,"xmax":-11798437.345061889,"ymax":4187927.1848278116,"spatialReference":{"wkid":102100}}', | |
| imageDisplay: '400,400,96', | |
| geometryType: 'esriGeometryPoint', | |
| sr: '102100', | |
| layers: 'all:0' | |
| }; | |
| var url = 'http://planthardiness.ars.usda.gov/ArcGIS/rest/services/uspz/MapServer/identify?' + querystring.stringify(q); | |
| console.error(url); | |
| var http = require('http'); | |
| http.get(url, function(res) { | |
| res.pipe(process.stdout); | |
| }); |
| { | |
| "name": "esri-query", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "index.js", | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1" | |
| }, | |
| "author": "", | |
| "license": "ISC", | |
| "dependencies": { | |
| "proj4": "^2.3.12", | |
| "sphericalmercator": "^1.0.4" | |
| } | |
| } |