Skip to content

Commit

Permalink
More examples in README.
Browse files Browse the repository at this point in the history
  • Loading branch information
rvernagus committed Jan 21, 2013
1 parent 6188a13 commit 4900090
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions README.md
Expand Up @@ -7,6 +7,12 @@ A thin Node.js client for the ESRI GeoServices API.

http://www.esri.com/library/whitepapers/pdfs/geoservices-rest-spec.pdf

### Usage
Require:
```javascript
var geoservices = require('geoservices');
```

### Using Map Services
Export an image of a map:
```javascript
Expand Down Expand Up @@ -44,6 +50,58 @@ geoservices.get(options, function(result) {
});
```

An Identify operation on a map looks like this:
```javascript
var options = {
host: 'sampleserver1.arcgisonline.com',
path: '/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer/identify',
params: {
geometryType: 'esriGeometryPoint',
geometry: '-120,40',
tolerance: 10,
mapExtent: '-119,38,-121,41',
imageDisplay: '400,300,96',
returnGeometry: true
}
};

geoservices.get(options, function(result) {
console.log(result);
});
```

Query by attributes:
```javascript
var options = {
host: 'sampleserver1.arcgisonline.com',
path: '/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer/1/query',
params: {
where: 'UPPER(STATE_NAME)=UPPER(\'colorado\')'
}
};

geoservices.get(options, function(result) {
console.log('Found: ' + result.features[0].attributes.STATE_NAME);
});
```

Spatial query:
```javascript
options = {
host: 'sampleserver1.arcgisonline.com',
path: '/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer/1/query',
params: {
geometry: '-125.4,35.2,-118.7,43.8',
geometryType: 'esriGeometryEnvelope',
where: 'POP1999>5000000'
}
};

geoservices.get(options, function(result) {
console.log('Found: ' + result.features[0].attributes.STATE_NAME);
});
```

## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.

Expand Down

0 comments on commit 4900090

Please sign in to comment.