esri-leaflet
Advanced tools
Comparing version 0.0.1-beta.5 to 0.0.1-beta.6
{ | ||
"name": "esri-leaflet", | ||
"version": "0.0.1-beta.5", | ||
"version": "v0.0.1-beta.6", | ||
"main": "dist/esri-leaflet.js", | ||
@@ -5,0 +5,0 @@ "ignore": [ |
# Changelog | ||
## Beta 6 | ||
#### Breaking Changes | ||
* `L.esri.Tasks.Identify` has been renamed to `L.esri.Tasks.IdentifyFeatures`. This is to reduce confusion with `L.esri.Tasks.IdentifyImage` and to clearly deliniate what these 2 classes do. | ||
#### Changes | ||
* Logo position can now be controlled by using the `logoPosition` option on `L.esri.BasemapLayer` https://github.com/Esri/esri-leaflet/issues/210 | ||
* Logo can now be hidden entirely and readded to the map with the `L.esri.Controls.Logo` class. **If you use Esris map tiles you must display the Esri Logo!** | ||
* Fix a regression from Beta 4 where features could not be loaded from ArcGIS Server if they were in non-mercator references. https://github.com/Esri/esri-leaflet/issues/283 https://github.com/Esri/esri-leaflet/pull/322 | ||
* The `addFeature`, `removeFeature`, `updateFeature` methods will no longer throw errors when callbacks are omitted. https://github.com/Esri/esri-leaflet/issues/285 | ||
* `deleteFeature` now properly removes the feature from the map so it will now appear after zooming or panning. https://github.com/Esri/esri-leaflet/issues/284 | ||
* New `createfeature`, `addfeature` and `removefeature` events on `L.esri.FeatureLayer`. https://github.com/Esri/esri-leaflet/issues/282 | ||
* `L.esri.Tasks.Query` now supports Map Services and Image Services with the new `query.layer(id)` and `query.pixelSize(point)` params respectivly | ||
* New `L.esri.Tasks.Find` task for searching feature text in Map Services https://github.com/Esri/esri-leaflet/pull/287. Thanks @rdjurasaj-usgs! | ||
* Support for image services via `L.esri.Layers.ImageMapLayer`. Thanks @rdjurasaj-usgs and @tomwayson | ||
* `L.esri.Tasks.IdentifyImage` for identifying images. Thanks @tomwayson. | ||
#### Misc | ||
* [New example](esri.github.io/esri-leaflet/examples/parse-feature-collection.html) for parsing [Feature Collections](http://resources.arcgis.com/en/help/arcgis-rest-api/#/featureCollection/02r30000003m000000/) from ArcGIS Online. | ||
* * Travis CI is now running tests https://github.com/Esri/esri-leaflet/pull/271 | ||
* Build are no longer saved in the `/dist` folder. https://github.com/Esri/esri-leaflet/pull/307 | ||
* [Development Roadmap](https://github.com/Esri/esri-leaflet/wiki/Roadmap) has been updated. | ||
## Beta 5 | ||
@@ -4,0 +28,0 @@ |
Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](https://github.com/esri/contributing). | ||
### Before filing an issue | ||
Please take a look at previous issues that resolve common problems https://github.com/Esri/esri-leaflet/issues?labels=FAQ&milestone=&page=1&state=closed. | ||
### I want to contribute, what should I work on? | ||
There is a lot of room for contributions to Esri Leaflet. Make sure you checkout the [development instructions](https://github.com/Esri/esri-leaflet#development-instructions) in the readme to help you get started. | ||
##### More examples | ||
The Esri Leaflet website is written using http://assemble.io/ and can be found at https://github.com/Esri/esri-leaflet/tree/master/site/source. You can use the existing examples as a reference. | ||
##### More tests | ||
Esri Leaflet has a fairly comprehensive test suite built with [Mocha](http://visionmedia.github.io/mocha/), [Chai](http://chaijs.com/), [Sinon](http://sinonjs.org), [Karma](http://karma-runner.github.io/0.12/index.html) and [Grunt](http://gruntjs.com/). Tests can be found in at https://github.com/Esri/esri-leaflet/tree/master/spec. | ||
You can run the tests with the `grunt karma:watch` to watch files and rerun test automatically and `grunt karma:coverage` (to generate a code coverage report. | ||
##### Support for new services and layer types | ||
support for new layer types and services are always needed the [plugin canidates](https://github.com/Esri/esri-leaflet/issues?labels=Plugin+Canidate&page=1&state=open) list is a good place to start. | ||
### Can I publish my own Esri Leaflet plugins? | ||
Of course! if you develop reusuable components for using or for use with Esri Leaflet that you think would be useful for other developers, please [file an issue](https://github.com/Esri/esri-leaflet/issues?state=open) so we discuss it. | ||
### Setting up a dev environment | ||
Make Sure you have the [Grunt CLI](http://gruntjs.com/getting-started) installed. | ||
1. [Fork and clone Esri Leaflet](https://help.github.com/articles/fork-a-repo) | ||
2. `cd` into the `esri-leaflet` folder | ||
5. Install the dependencies with `npm install` | ||
5. run `grunt` from the command line. This will start the web server locally at [http://localhost:8001](http://localhost:8001) and start watching the source files and running linting and testing commands. | ||
6. Make your changes and create a [pull request](https://help.github.com/articles/creating-a-pull-request) | ||
### Linting | ||
Please make sure your changes pass JS Hint. This will help make sure code is consistant throguh out Esri Leaflet. You can run JS Hint with `grunt jshint`. | ||
### Testing | ||
Please make sure your changes dont break existing tests. Testing is essential for determining backward compatibility and catching breaking changes. You can run tests with `grunt karma:run`, `grunt karma:watch` or `grunt karma:coverage.` |
@@ -42,3 +42,3 @@ var fs = require('fs'); | ||
files: ['site/source/**/*.js'], | ||
tasks: ['copy:assemble'], | ||
tasks: ['concat', 'uglify', 'copy:assemble'], | ||
options: { | ||
@@ -87,9 +87,17 @@ nospawn: true | ||
'src/Services/MapService.js', | ||
'src/Tasks/**/*.js', | ||
'src/Services/ImageService.js', | ||
'src/Tasks/Query.js', | ||
'src/Tasks/Find.js', | ||
'src/Tasks/Identify.js', | ||
'src/Tasks/IdentifyImage.js', | ||
'src/Tasks/IdentifyFeatures.js', | ||
'src/Layers/BasemapLayer.js', | ||
'src/Layers/RasterLayer.js', | ||
'src/Layers/DynamicMapLayer.js', | ||
'src/Layers/ImageMapLayer.js', | ||
'src/Layers/TiledMapLayer.js', | ||
'src/Layers/FeatureLayer/FeatureGrid.js', | ||
'src/Layers/FeatureLayer/FeatureManager.js', | ||
'src/Layers/FeatureLayer/FeatureLayer.js' | ||
'src/Layers/FeatureLayer/FeatureLayer.js', | ||
'src/Controls/Logo.js' | ||
], | ||
@@ -111,3 +119,4 @@ dest: 'dist/esri-leaflet-src.js' | ||
'src/Request.js', | ||
'src/Layers/BasemapLayer.js' | ||
'src/Layers/BasemapLayer.js', | ||
'/src/Controls/Logo.js' | ||
], | ||
@@ -124,8 +133,26 @@ dest: 'dist/builds/basemaps/esri-leaflet-basemaps-src.js' | ||
'src/Tasks/Identify.js', | ||
'src/Tasks/IdentifyFeatures.js', | ||
'src/Tasks/Query.js', | ||
'src/Layers/DynamicMapLayer', | ||
'src/Layers/TiledMapLayer' | ||
'src/Tasks/Find.js', | ||
'src/Layers/RasterLayer.js', | ||
'src/Layers/DynamicMapLayer.js', | ||
'src/Layers/TiledMapLayer.js' | ||
], | ||
dest: 'dist/builds/map-service/esri-leaflet-map-service-src.js' | ||
}, | ||
imageservice: { | ||
src: [ | ||
'src/EsriLeaflet.js', | ||
'src/Util.js', | ||
'src/Request.js', | ||
'src/Services/Service.js', | ||
'src/Services/ImageService.js', | ||
'src/Tasks/Query.js', | ||
'src/Tasks/Identify.js', | ||
'src/Tasks/Identify/IdentifyImage.js', | ||
'src/Layers/RasterLayer.js', | ||
'src/Layers/ImageMapLayer.js' | ||
], | ||
dest: 'dist/builds/image-service/esri-leaflet-image-service-src.js' | ||
}, | ||
featureservice: { | ||
@@ -151,3 +178,3 @@ src: [ | ||
src: ['src/Layers/HeatMapFeatureLayer/HeatMapFeatureLayer.js'], | ||
dest: 'dist/builds/heatmap-feature-layer/esri-leafelt-heatmap-feature-layer-src.js' | ||
dest: 'dist/builds/heatmap-feature-layer/esri-leaflet-heatmap-feature-layer-src.js' | ||
} | ||
@@ -179,4 +206,4 @@ }, | ||
], | ||
'dist/builds/heatmap-feature-layer/esri-leafelt-heatmap-feature-layer.js': [ | ||
'dist/builds/heatmap-feature-layer/esri-leafelt-heatmap-feature-layer-src.js' | ||
'dist/builds/heatmap-feature-layer/esri-leaflet-heatmap-feature-layer.js': [ | ||
'dist/builds/heatmap-feature-layer/esri-leaflet-heatmap-feature-layer-src.js' | ||
], | ||
@@ -186,2 +213,5 @@ 'dist/builds/map-service/esri-leaflet-map-service.js': [ | ||
], | ||
'dist/builds/image-service/esri-leaflet-image-service.js': [ | ||
'dist/builds/image-service/esri-leaflet-image-service-src.js' | ||
], | ||
'dist/builds/feature-layer/esri-leaflet-feature-layer.js': [ | ||
@@ -298,3 +328,3 @@ 'dist/builds/feature-layer/esri-leaflet-feature-layer-src.js' | ||
base: 'site/build', | ||
repo: grunt.option('repo') | ||
repo: 'git@github.com:Esri/esri-leaflet.git' | ||
}, | ||
@@ -324,2 +354,12 @@ src: ['**'] | ||
} | ||
}, | ||
releaseable: { | ||
release: { | ||
options: { | ||
remote: 'upstream', | ||
dryRun: grunt.option('dryRun') ? grunt.option('dryRun') : false, | ||
silent: false | ||
} | ||
} | ||
} | ||
@@ -336,10 +376,12 @@ }); | ||
grunt.registerTask('default', ['concurrent:dev']); | ||
grunt.registerTask('build', ['jshint', 'karma:coverage','concat', 'uglify']); | ||
grunt.registerTask('test', ['karma:run']); | ||
grunt.registerTask('build', ['jshint', 'karma:coverage', 'concat', 'uglify']); | ||
grunt.registerTask('test', ['jshint', 'karma:run']); | ||
grunt.registerTask('prepublish', ['concat', 'uglify']); | ||
grunt.registerTask('release', ['releaseable', 's3']); | ||
// Documentation Site Tasks | ||
grunt.registerTask('docs', ['assemble:dev', 'sass', 'copy', 'connect:docs', 'watch']); | ||
grunt.registerTask('docs', ['assemble:dev', 'concat', 'uglify', 'sass', 'copy', 'connect:docs', 'watch']); | ||
// Documentation Site Tasks | ||
grunt.registerTask('docs:build', ['assemble:build', 'sass', 'gh-pages']); | ||
grunt.registerTask('docs:build', ['assemble:build', 'imagemin','sass', 'gh-pages']); | ||
@@ -346,0 +388,0 @@ // Require all grunt modules |
@@ -17,3 +17,3 @@ // Karma configuration | ||
'http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css', | ||
'http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js', | ||
'http://cdn.leafletjs.com/leaflet-0.7.3/leaflet-src.js', | ||
'http://cdn-geoweb.s3.amazonaws.com/Leaflet.heat/0.1.1/leaflet-heat.js', | ||
@@ -25,4 +25,6 @@ 'http://cdn-geoweb.s3.amazonaws.com/Leaflet.markercluster/0.4.0/leaflet.markercluster-src.js', | ||
'src/Layers/BasemapLayer.js', | ||
'src/Layers/RasterLayer.js', | ||
'src/Layers/TiledMapLayer.js', | ||
'src/Layers/DynamicMapLayer.js', | ||
'src/Layers/ImageMapLayer.js', | ||
'src/Layers/FeatureLayer/FeatureGrid.js', | ||
@@ -37,4 +39,9 @@ 'src/Layers/FeatureLayer/FeatureManager.js', | ||
'src/Services/MapService.js', | ||
'src/Services/ImageService.js', | ||
'src/Tasks/Query.js', | ||
'src/Tasks/Identify.js', | ||
'src/Tasks/IdentifyFeatures.js', | ||
'src/Tasks/IdentifyImage.js', | ||
'src/Tasks/Find.js', | ||
'src/Controls/Logo.js' | ||
], | ||
@@ -86,5 +93,5 @@ | ||
{type: 'text'} | ||
], | ||
] | ||
} | ||
}); | ||
}; |
{ | ||
"name": "esri-leaflet", | ||
"version": "0.0.1-beta.5", | ||
"version": "0.0.1-beta.6", | ||
"description": "Leaflet plugins for consuming ArcGIS Online and ArcGIS Server services", | ||
@@ -32,5 +32,7 @@ "main": "dist/esri-leaflet.js", | ||
"load-grunt-tasks": "^0.4.0", | ||
"highlight.js": "^8.0.0" | ||
"highlight.js": "^8.0.0", | ||
"grunt-releaseable": "0.0.8" | ||
}, | ||
"scripts": { | ||
"prepublish": "node -e \"require('grunt').tasks(['prepublish']);\"", | ||
"start": "node -e \"require('grunt').tasks(['default']);\"", | ||
@@ -37,0 +39,0 @@ "test": "node -e \"require('grunt').tasks(['test']);\"" |
# Esri Leaflet | ||
Leaflet plugins for [ArcGIS Services](http://developers.arcgis.com). Currently Esri Leaflet supports loading Esri [basemaps](http://esri.github.io/esri-leaflet/examples/switching-basemaps.html) and [feature services](http://esri.github.io/esri-leaflet/examples/simple-feature-layer.html), as well as [tiled](http://esri.github.io/esri-leaflet/examples/tile-layer-2.html) and [dynamic](http://esri.github.io/esri-leaflet/examples/simple-dynamic-map-layer.html) map services. | ||
[![Build Status](https://travis-ci.org/Esri/esri-leaflet.svg)](https://travis-ci.org/Esri/esri-leaflet) | ||
Leaflet plugins for [ArcGIS Services](http://developers.arcgis.com). Currently Esri Leaflet supports loading Esri [basemaps](http://esri.github.io/esri-leaflet/examples/switching-basemaps.html) and [feature services](http://esri.github.io/esri-leaflet/examples/simple-feature-layer.html), as well as [tiled](http://esri.github.io/esri-leaflet/examples/tile-layer-2.html), [dynamic](http://esri.github.io/esri-leaflet/examples/simple-dynamic-map-layer.html) and [image](http://esri.github.io/esri-leaflet/examples/simple-image-map-layer.html) map services. | ||
The goal of Esri Leaflet is **not** to replace the [ArcGIS API for JavaScript](https://developers.arcgis.com/en/javascript/), but rather to provide small components to allow developers to build mapping applications with Leaflet. | ||
@@ -62,2 +64,21 @@ | ||
### Development Roadmap | ||
If you are interested in contributing to Esri Leaflet or are interetsed in seeing what is coming up next checkout the [development roadmap](https://github.com/Esri/esri-leaflet/wiki/Roadmap). | ||
### Freqently Asked Questions | ||
* [Will Esri Leaflet replace the ArcGIS API for JavaScript?](https://github.com/Esri/esri-leaflet/wiki/FAQ#will-esri-leaflet-replace-the-arcgis-api-for-javascript) | ||
* [What are the goals of Esri Leaflet?](https://github.com/Esri/esri-leaflet/wiki/FAQ#what-are-the-goals-of-esri-leaflet) | ||
* [When will Esri Leaflet leave beta?](https://github.com/Esri/esri-leaflet/wiki/FAQ#when-will-esri-leaflet-leave-beta) | ||
* [How do you decide what features get included in Esri Leaflet?](https://github.com/Esri/esri-leaflet/wiki/FAQ#how-do-you-decide-what-features-get-included-in-esri-leaflet) | ||
* [I have an idea! What should I do?](https://github.com/Esri/esri-leaflet/wiki/FAQ#i-have-an-idea-what-should-i-do) | ||
* [When will you support "x"?](https://github.com/Esri/esri-leaflet/wiki/FAQ#when-will-you-support-x) | ||
* [Can you implement feature "x"?](https://github.com/Esri/esri-leaflet/wiki/FAQ#can-you-implement-feature-x) | ||
* [When will feature "x" get done?](https://github.com/Esri/esri-leaflet/wiki/FAQ#when-will-feature-x-get-done) | ||
* [I want to contribute. How can I help?](https://github.com/Esri/esri-leaflet/wiki/FAQ#i-want-to-contribute-how-can-i-help) | ||
* [I built something with Esri Leaflet can I show you?](https://github.com/Esri/esri-leaflet/wiki/FAQ#i-built-something-with-esri-leaflet-can-i-show-you) | ||
* [I built a reusable component (layer type, api wrapper, ui control ect...) can I contribute it to Esri Leaflet?](i-built-a-reusable-component-layer-type-api-wrapper-ui-control-ect-can-i-contribute-it-to-esri-leaflet) | ||
* [What are some good Leaflet Plugins?](https://github.com/Esri/esri-leaflet/wiki/FAQ#what-are-some-good-leaflet-plugins) | ||
### Projects Using Esri Leaflet | ||
@@ -82,4 +103,5 @@ | ||
### Dependencies | ||
* [Leaflet](http://leaflet.com) version 0.7 or higher is required. | ||
* [Leaflet](http://leaflet.com) version 0.7 or higher is required but the latest version is recommended. | ||
### Optional Dependencies | ||
@@ -86,0 +108,0 @@ * [Leaflet.markercluster](https://github.com/Leaflet/Leaflet.markercluster) - for `L.esri.ClusteredFeatureLayer` |
@@ -12,2 +12,4 @@ var bgmap = L.map('background-map', { | ||
L.esri.Layers.basemapLayer('Imagery').addTo(bgmap); | ||
L.esri.Layers.basemapLayer('Imagery', { | ||
hideLogo: true | ||
}).addTo(bgmap); |
@@ -34,2 +34,27 @@ --- | ||
### Feature Create | ||
`createfeature` is fired when a feature from the Feature Layer is loaded for the first time. | ||
| Data | Value | Description | | ||
| --- | --- | --- | | ||
| `feature` | [`GeoJSON Feature`](http://geojson.org/geojson-spec.html#feature-objects) | GeoJSON respresentation of the feature that was created. | | ||
### Feature Remove | ||
`removefeature` is fired when a feature is removed from the map, either as the result of a filter operation or because it was deleted from the service. | ||
| Data | Value | Description | | ||
| --- | --- | --- | | ||
| `feature` | [`GeoJSON Feature`](http://geojson.org/geojson-spec.html#feature-objects) | GeoJSON respresentation of the feature that was created. | | ||
| `permanent` | `Boolean` | `true` if the feature was permanently deleted from the service or `false` if the feature was removed as the result of a filter operation. | ||
### Feature Add | ||
`addfeature` is fired when a feature that has already been created is added to the map again, usually the result of a filtering operation. | ||
| Data | Value | Description | | ||
| --- | --- | --- | | ||
| `feature` | [`GeoJSON Feature`](http://geojson.org/geojson-spec.html#feature-objects) | GeoJSON respresentation of the feature that was added. | | ||
### Request Event | ||
@@ -36,0 +61,0 @@ |
@@ -23,3 +23,3 @@ --- | ||
<tr> | ||
<td><code class="nobr">new L.esri.Layers.ClusteredFeatureLayer({{{param 'String' 'key'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">L.esri.Layers.clusteredFeatureLayer({{{param 'String' 'key'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">new L.esri.ClusteredFeatureLayer({{{param 'String' 'key'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">L.esri.clusteredFeatureLayer({{{param 'String' 'key'}}}, {{{param 'Object' 'options'}}})</code></td> | ||
<td><code class="nobr">new L.esri.Layers.ClusteredFeatureLayer({{{param 'String' 'url'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">L.esri.Layers.clusteredFeatureLayer({{{param 'String' 'url'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">new L.esri.ClusteredFeatureLayer({{{param 'String' 'url'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">L.esri.clusteredFeatureLayer({{{param 'String' 'url'}}}, {{{param 'Object' 'options'}}})</code></td> | ||
<td><code>url</code> should be the URL to the Feature Layer.</td> | ||
@@ -107,3 +107,3 @@ </tr> | ||
<tr> | ||
<td><code>useCORS</code></td> | ||
<td><code>useCors</code></td> | ||
<td><code>Boolean</code></td> | ||
@@ -123,4 +123,7 @@ <td>If this service should use CORS when making GET requests.</td> | ||
| `load` | [<`LoadEvent`>]({{assets}}api-reference/events.html#load-event) | Fires when all features in the current bounds of the map have loaded. | | ||
| `createfeature` | [<`CreateFeatureEvent`>]({{assets}}api-reference/events.html#feature-create) | Fired when a feature from the Feature Layer is loaded for the first time. | | ||
| `removefeature` | [<`RemoveFeatureEvent`>]({{assets}}api-reference/events.html#feature-remove) | Fired when a feature on the layer is removed from the map. | | ||
| `addfeature` | [<`AddFeatureEvent`>]({{assets}}api-reference/events.html#feature-add) | Fired when a previously removed feature is added back to the map. | | ||
`L.esri.Layer.FeatureLayer` also fires all [`L.esri.Service.FeatureLayer`]({{assets}}/api-reference/services/feature-layer.html) events. | ||
`L.esri.Layer.FeatureLayer` also fires all [`L.esri.Service.FeatureLayer`]({{assets}}api-reference/services/feature-layer.html) events. | ||
@@ -127,0 +130,0 @@ In additon to these events `L.esri.FeatureLayer` also fires the following [Mouse Events](http://leafletjs.com/reference.html#event-objects) `click`, `dblclick`, `mouseover`, `mouseout`, `mousemove`, and `contextmenu`, `clusterclick`, `clusterdblclick`, `clustermouseover`, `vmouseout`, `clustermousemove`, and `clustercontextmenu` as well as the following the [Popup Events](http://leafletjs.com/reference.html#event-objects) `popupopen` and `popupclose`. |
@@ -8,2 +8,4 @@ --- | ||
<!-- Inherits from [`L.esri.Layers.RasterLayer`]({{assets}}api-reference/layers/raster-layer.html) --> | ||
Render and visualize Map Services from ArcGIS Online and ArcGIS Server. L.esri.Layers.DynamicMapLayer also supports custom popups and identification of features. | ||
@@ -24,3 +26,3 @@ | ||
<tr> | ||
<td><code class="nobr">new L.esri.Layers.DynamicMapLayer({{{param 'String' 'key'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">L.esri.Layers.dynamicMapLayer({{{param 'String' 'key'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">new L.esri.DynamicMapLayer({{{param 'String' 'key'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">L.esri.dynamicMapLayer({{{param 'String' 'key'}}}, {{{param 'Object' 'options'}}})</code></td> | ||
<td><code class="nobr">new L.esri.Layers.DynamicMapLayer({{{param 'String' 'url'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">L.esri.Layers.dynamicMapLayer({{{param 'String' 'url'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">new L.esri.DynamicMapLayer({{{param 'String' 'url'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">L.esri.dynamicMapLayer({{{param 'String' 'url'}}}, {{{param 'Object' 'options'}}})</code></td> | ||
<td><code>url</code> should be the URL to the Map Service hosted the tiles. The <code>options</code> parameter can accept the same options as <a href="http://leafletjs.com/reference.html#tilelayer"><code>L.TileLayer</code></a></td> | ||
@@ -39,12 +41,12 @@ </tr> | ||
`transparent` | `Boolean` | `true` | Allow the server to produce transparent images. | ||
`f` | `String` | `'image'` | Output type | ||
`f` | `String` | `'image'` | Server response content type. | ||
`bboxSR` | `Integer` | `4326` | Spatial reference of the bounding box to generate the image with. If you don't know what this is don't change it. | ||
`imageSR` | | `3857` | Spatial reference of the output image. If you don't know what this is don't change it. | ||
`imageSR` | `Integer` | `3857` | Spatial reference of the output image. If you don't know what this is don't change it. | ||
`layers` | `Array` | `''` | An array of Layer IDs like `[3,4,5]` to show from the service. | ||
`layerDefs` | `String` `Object` | `''` | A string representing a query to run against the service before the image is rendered. This can be a string like `"STATE_NAME='Kansas' and POP2007>25000"` or an object mapping different queries to specific layers `{5:"STATE_NAME='Kansas'", 4:"STATE_NAME='Kansas'}`. | ||
`opacity` | `Integer` | `1` | Opacity of the layer. Should be a value between 0 and 1. | ||
`position` | `String` | '"front"` | position of the layer relative to other overlays | ||
`opacity` | `Number` | `1` | Opacity of the layer. Should be a value between 0 and 1. | ||
`position` | `String` | `'front'` | Position of the layer relative to other overlays. | ||
`token` | `String` | `null` | If you pass a token in your options it will included in all requests to the service. See [working with authenticated services](#working-with-authenticated-services) for more information. | ||
`proxy` | `String` | `false` | URL of an [ArcGIS API for JavaScript proxies](https://developers.arcgis.com/javascript/jshelp/ags_proxy.html) or [ArcGIS Resource Proxies](https://github.com/Esri/resource-proxy) to use for proxying POST requests. | ||
`useCORS` | `Boolean` | `true` | If this service should use CORS when making GET requests. | ||
`useCors` | `Boolean` | `true` | If this service should use CORS when making GET requests. | ||
@@ -76,3 +78,3 @@ ### Methods | ||
<td> | ||
Uses the provided function to create a popup that will identify features whenever the map is clicked. Your function will be passed a <a href="http://geojson.org/geojson-spec.html#feature-collection-objects">GeoJSON FeatureCollection</a> of teh features at the clicked location and should return the appropriate HTML. If you do not want to open the popup when there are no results, return <code>false</code>. | ||
Uses the provided function to create a popup that will identify features whenever the map is clicked. Your function will be passed a <a href="http://geojson.org/geojson-spec.html#feature-collection-objects">GeoJSON FeatureCollection</a> of the features at the clicked location and should return the appropriate HTML. If you do not want to open the popup when there are no results, return <code>false</code>. | ||
<pre class="js"><code>dynamicMapLayer.bindPopup(function(err, features, response){ | ||
@@ -144,3 +146,3 @@ var count = featureCollection.features.length; | ||
Requests metadata about this Feature Layer. Callback will be called with `error` and `metadata`. | ||
<pre class="js"><code>featureLayer.metadata(function(error, metadata){ | ||
<pre class="js"><code>dynamicMapLayer.metadata(function(error, metadata){ | ||
console.log(metadata); | ||
@@ -159,4 +161,4 @@ });</code></pre> | ||
<td> | ||
Returns a new <a href=""><code>L.esri.services.Identify</code></a> object that can be used to identify features on this layer. Your callback function will be passed a <a href="http://geojson.org/geojson-spec.html#feature-collection-objects">GeoJSON FeatureCollection</a> with the results or an error. | ||
<pre class="js"><code>featureLayer.identify() | ||
Returns a new <a href="/api-reference/tasks/identify-features.html"><code>L.esri.services.IdentifyFeatures</code></a> object that can be used to identify features on this layer. Your callback function will be passed a <a href="http://geojson.org/geojson-spec.html#feature-collection-objects">GeoJSON FeatureCollection</a> with the results or an error. | ||
<pre class="js"><code>dynamicMapLayer.identify() | ||
.at(latlng, latlngbounds, 5) | ||
@@ -168,2 +170,28 @@ .run(function(error, featureCollection){ | ||
</tr> | ||
<tr> | ||
<td><code>find()</code></td> | ||
<td><code>this</code></td> | ||
<td> | ||
Returns a new <a href="/api-reference/tasks/find.html"><code>L.esri.services.Find</code></a> object that can be used to find features. Your callback function will be passed a <a href="http://geojson.org/geojson-spec.html#feature-collection-objects">GeoJSON FeatureCollection</a> with the results or an error. | ||
<pre class="js"><code>dynamicMapLayer.find() | ||
.layers('18') | ||
.searchText('Colorado') | ||
.run(function(error, featureCollection){ | ||
console.log(featureCollection); | ||
});</code></pre> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td><code>query()</code></td> | ||
<td><code>this</code></td> | ||
<td> | ||
Returns a new <a href="{{assets}}api-reference/tasks/query.html"><code>L.esri.Tasks.Query</code></a> object that can be used to query this service. | ||
<pre class="js"><code>mapService.query() | ||
.layer(0) | ||
.within(latlngbounds) | ||
.run(function(error, featureCollection, response){ | ||
console.log(featureCollection); | ||
});</code></pre> | ||
</td> | ||
</tr> | ||
</tbody> | ||
@@ -179,3 +207,3 @@ </table> | ||
`L.esri.Layer.DynamicMapLayer` also fires all [`L.esri.Service.MapService`]({{assets}}/api-reference/services/map-service.html) events. | ||
`L.esri.Layer.DynamicMapLayer` also fires all [`L.esri.Service.MapService`]({{assets}}api-reference/services/map-service.html) events. | ||
@@ -182,0 +210,0 @@ ### Example |
@@ -18,3 +18,3 @@ --- | ||
FeatureServer` note that it ends in `/FeatureService`. This particular service contains only 1 Feature Layer | ||
This particular service contains only one Feature Layer. Here is the Feature Layer URL | ||
@@ -25,3 +25,3 @@ ``` | ||
Note that the Feature Layer url ends in `/FeatureService/{LAYER_ID}`. | ||
Note that the Feature Layer URL ends in `/FeatureServer/{LAYER_ID}`. | ||
@@ -41,3 +41,3 @@ You can create a new empty feature service witha single layer on the [ArcGIS for Devleopers website](https://developers.arcgis.com/en/hosted-data/#/new) or you can use ArcGIS Online to [create a Feature Service from a CSV or Shapefile](https://developers.arcgis.com/tools/csv-to-feature-service/). | ||
<tr> | ||
<td><code class="nobr">new L.esri.Layers.FeatureLayer({{{param 'String' 'key'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">L.esri.Layers.featureLayer({{{param 'String' 'key'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">new L.esri.FeatureLayer({{{param 'String' 'key'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">L.esri.featureLayer({{{param 'String' 'key'}}}, {{{param 'Object' 'options'}}})</code></td> | ||
<td><code class="nobr">new L.esri.Layers.FeatureLayer({{{param 'String' 'url'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">L.esri.Layers.featureLayer({{{param 'String' 'url'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">new L.esri.FeatureLayer({{{param 'String' 'url'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">L.esri.featureLayer({{{param 'String' 'url'}}}, {{{param 'Object' 'options'}}})</code></td> | ||
<td><code>url</code> should be the URL to the Feature Layer.</td> | ||
@@ -125,3 +125,3 @@ </tr> | ||
<tr> | ||
<td><code>useCORS</code></td> | ||
<td><code>useCors</code></td> | ||
<td><code>Boolean</code></td> | ||
@@ -139,4 +139,7 @@ <td>If this service should use CORS when making GET requests.</td> | ||
| `load` | [<`LoadEvent`>]({{assets}}api-reference/events.html#load-event) | Fires when all features in the current bounds of the map have loaded. | | ||
| `createfeature` | [<`CreateFeatureEvent`>]({{assets}}api-reference/events.html#feature-create) | Fired when a feature from the Feature Layer is loaded for the first time. | | ||
| `removefeature` | [<`RemoveFeatureEvent`>]({{assets}}api-reference/events.html#feature-remove) | Fired when a feature on the layer is removed from the map. | | ||
| `addfeature` | [<`AddFeatureEvent`>]({{assets}}api-reference/events.html#feature-add) | Fired when a previously removed feature is added back to the map. | | ||
`L.esri.Layer.FeatureLayer` also fires all [`L.esri.Service.FeatureLayer`]({{assets}}/api-reference/services/feature-layer.html) events. | ||
`L.esri.Layer.FeatureLayer` also fires all [`L.esri.Service.FeatureLayer`]({{assets}}api-reference/services/feature-layer.html) events. | ||
@@ -143,0 +146,0 @@ In additon to these events `L.esri.Layer.FeatureLayer` also fires the following [Mouse Events](http://leafletjs.com/reference.html#event-objects) `click`, `dblclick`, `mouseover`, `mouseout`, `mousemove`, and `contextmenu` and the following the [Popup Events](http://leafletjs.com/reference.html#event-objects) `popupopen` and `popupclose` |
@@ -23,3 +23,3 @@ --- | ||
<tr> | ||
<td><code class="nobr">new L.esri.Layers.HeatmapFeatureLayer({{{param 'String' 'key'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">L.esri.Layers.heatmapFeatureLayer({{{param 'String' 'key'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">new L.esri.HeatmapFeatureLayer({{{param 'String' 'key'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">L.esri.heatmapFeatureLayer({{{param 'String' 'key'}}}, {{{param 'Object' 'options'}}})</code></td> | ||
<td><code class="nobr">new L.esri.Layers.HeatmapFeatureLayer({{{param 'String' 'url'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">L.esri.Layers.heatmapFeatureLayer({{{param 'String' 'url'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">new L.esri.HeatmapFeatureLayer({{{param 'String' 'url'}}}, {{{param 'Object' 'options'}}})</code><br><br><code class="nobr">L.esri.heatmapFeatureLayer({{{param 'String' 'url'}}}, {{{param 'Object' 'options'}}})</code></td> | ||
<td><code>url</code> should be the URL to the Feature Layer.</td> | ||
@@ -86,3 +86,3 @@ </tr> | ||
<tr> | ||
<td><code>useCORS</code></td> | ||
<td><code>useCors</code></td> | ||
<td><code>Boolean</code></td> | ||
@@ -103,3 +103,3 @@ <td>If this service should use CORS when making GET requests.</td> | ||
`L.esri.Layer.FeatureLayer` also fires all [`L.esri.Service.FeatureLayer`]({{assets}}/api-reference/services/feature-layer.html) events. | ||
`L.esri.Layer.FeatureLayer` also fires all [`L.esri.Service.FeatureLayer`]({{assets}}api-reference/services/feature-layer.html) events. | ||
@@ -106,0 +106,0 @@ ### Methods |
@@ -11,2 +11,3 @@ --- | ||
* [`L.esri.Layers.DynamicMapLayer`]({{assets}}api-reference/layers/dynamic-map-layer.html) | ||
* [`L.esri.Layers.ImageMapLayer`]({{assets}}api-reference/layers/image-map-layer.html) | ||
* [`L.esri.Layers.TiledMapLayer`]({{assets}}api-reference/layers/tiled-map-layer.html) | ||
@@ -13,0 +14,0 @@ * [`L.esri.Layers.FeatureLayer`]({{assets}}api-reference/layers/feature-layer.html) |
@@ -38,3 +38,3 @@ --- | ||
| `proxy` | `String` | `false` | URL of an [ArcGIS API for JavaScript proxies](https://developers.arcgis.com/javascript/jshelp/ags_proxy.html) or [ArcGIS Resource Proxies](https://github.com/Esri/resource-proxy) to use for proxying POST requests. | | ||
| `useCORS` | `Boolean` | `true` | If this service should use CORS when making GET requests. | | ||
| `useCors` | `Boolean` | `true` | If this service should use CORS when making GET requests. | | ||
@@ -73,3 +73,3 @@ `L.esri.TiledMapLayer` also accepts all [`L.TileLayer`](http://leafletjs.com/reference.html#tilelayer-options) options. | ||
<td> | ||
Returns a new <a href=""><code>L.esri.services.Identify</code></a> object that can be used to identify features on this layer. Your callback function will be passed a GeoJSON FeatureCollection with the results or an error. | ||
Returns a new <a href="/api-reference/tasks/identify-features.html"><code>L.esri.services.IdentifyFeatures</code></a> object that can be used to identify features on this layer. Your callback function will be passed a GeoJSON FeatureCollection with the results or an error. | ||
<pre class="js"><code>featureLayer.identify() | ||
@@ -76,0 +76,0 @@ .at(latlng, latlngbounds, 5) |
@@ -8,3 +8,3 @@ --- | ||
Inherits from [`L.esri.Service`]({{assets}}/api-reference/services/service.html) | ||
Inherits from [`L.esri.Service`]({{assets}}api-reference/services/service.html) | ||
@@ -32,7 +32,7 @@ `L.esri.Services.FeatureLayer` is an abstraction interacting with Feature Layers running on ArcGIS Online and ArcGIS server that allows you to make requests to the API, as well as query, add, update and remove features from the service. | ||
`L.esri.Services.FeatureLayer` accepts all [`L.esri.Services.Service`]({{assets}}/api-reference/services/service.html) options. | ||
`L.esri.Services.FeatureLayer` accepts all [`L.esri.Services.Service`]({{assets}}api-reference/services/service.html) options. | ||
### Events | ||
`L.esri.Services.FeatureLayer` fires all [`L.esri.Services.service`]({{assets}}/api-reference/services/service.html) events. | ||
`L.esri.Services.FeatureLayer` fires all [`L.esri.Services.service`]({{assets}}api-reference/services/service.html) events. | ||
@@ -54,7 +54,7 @@ ### Methods | ||
<td> | ||
Returns a new <a href="{{assets}}/api-reference/tasks/query.html"><code>L.esri.Tasks.Query</code></a> object that can be used to query this layer. | ||
Returns a new <a href="{{assets}}api-reference/tasks/query.html"><code>L.esri.Tasks.Query</code></a> object that can be used to query this layer. | ||
<pre class="js"><code>featureLayer.query() | ||
.within(latlngbounds) | ||
.where("Direction = 'WEST'") | ||
.run(function(error, featureCollection){ | ||
.run(function(error, featureCollection, response){ | ||
console.log(featureCollection); | ||
@@ -61,0 +61,0 @@ });</code></pre> |
@@ -12,2 +12,3 @@ --- | ||
* [`L.esri.Services.MapService`]({{assets}}api-reference/services/map-service.html) | ||
* [`L.esri.Services.ImageService`]({{assets}}api-reference/services/image-service.html) | ||
* [`L.esri.Services.FeatureLayer`]({{assets}}api-reference/services/feature-layer.html) |
@@ -8,3 +8,3 @@ --- | ||
Inherits from [`L.esri.Service`]({{assets}}/api-reference/services/service.html) | ||
Inherits from [`L.esri.Service`]({{assets}}api-reference/services/service.html) | ||
@@ -32,20 +32,70 @@ `L.esri.Services.MapService` is an abstraction interacting with Map Services running on ArcGIS Online and ArcGIS server that allows you to make requests to the API, as well as query and identify features on the service. | ||
`L.esri.Services.MapService` accepts all [`L.esri.Services.Service`]({{assets}}/api-reference/services/service.html) options. | ||
`L.esri.Services.MapService` accepts all [`L.esri.Services.Service`]({{assets}}api-reference/services/service.html) options. | ||
### Events | ||
`L.esri.Services.MapService` fires all [`L.esri.Services.service`]({{assets}}/api-reference/services/service.html) events. | ||
`L.esri.Services.MapService` fires all [`L.esri.Services.service`]({{assets}}api-reference/services/service.html) events. | ||
### Methods | ||
| Method | Returns | Description | | ||
| --- | --- | --- | | ||
| `identify()` | `this` | Returns a new [`L.esri.Tasks.Identify()`]({{assets}}/api-reference/tasks/query.html) object bound to this service. | | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Method</th> | ||
<th>Returns</th> | ||
<th>Description</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td><code>query()</code></td> | ||
<td><code>this</code></td> | ||
<td> | ||
Returns a new <a href="{{assets}}api-reference/tasks/query.html"><code>L.esri.Tasks.Query</code></a> object that can be used to query this service. | ||
<pre class="js"><code>mapService.query() | ||
.layer(0) | ||
.within(latlngbounds) | ||
.run(function(error, featureCollection, response){ | ||
console.log(featureCollection); | ||
});</code></pre> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td><code>identify()</code></td> | ||
<td><code>this</code></td> | ||
<td> | ||
Returns a new <a href="{{assets}}api-reference/tasks/identify.html"><code>L.esri.Tasks.Identify</code></a> object that can be used to identify features contained within this service. | ||
<pre class="js"><code>mapService.identify() | ||
.on(map) | ||
.at(latlng) | ||
.run(function(error, featureCollection, response){ | ||
console.log(featureCollection) | ||
});</code></pre> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td><code>find()</code></td> | ||
<td><code>this</code></td> | ||
<td> | ||
Returns a new <a href="{{assets}}api-reference/tasks/find.html"><code>L.esri.Tasks.Find</code></a> object that can be used to find features by text. | ||
<pre class="js"><code>mapService.find() | ||
.layers('18') | ||
.text('Colorado') | ||
.fields('name') | ||
.run(function(error, featureCollection, response){ | ||
console.log(featureCollection) | ||
});</code></pre> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
### Example | ||
#### Identify task | ||
```js | ||
var map = new L.Map('map').setView([ 45.543, -122.621 ], 5); | ||
var service = L.esri.Services.MapService('http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer'); | ||
var service = L.esri.Services.mapService('http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer'); | ||
@@ -60,1 +110,15 @@ service.identify() | ||
``` | ||
#### Find task | ||
```js | ||
var service = L.esri.Services.mapService('http://services.nationalmap.gov/arcgis/rest/services/govunits/MapServer'); | ||
service.find() | ||
.layers('18') | ||
.searchText('Colorado') | ||
.searchFields('GNIS_NAME') | ||
.run(function(error, featureCollection, response){ | ||
console.log('Found GNIS ID: ' + featureCollection.features[0].properties.GNIS_ID + ' for the state of ' + featureCollection.features[0].properties.STATE_NAME); | ||
}); | ||
``` |
--- | ||
title: L.esri.Services.Service | ||
layout: documentation.hbs | ||
@@ -31,3 +32,3 @@ --- | ||
| `proxy` | `String` | `false` | URL of an [ArcGIS API for JavaScript proxies](https://developers.arcgis.com/javascript/jshelp/ags_proxy.html) or [ArcGIS Resource Proxies](https://github.com/Esri/resource-proxy) to use for proxying POST requests. | | ||
| `useCORS` | `Boolean` | `true` | If this service should use CORS when making GET requests. | | ||
| `useCors` | `Boolean` | `true` | If this service should use CORS when making GET requests. | | ||
@@ -34,0 +35,0 @@ ### Events |
@@ -11,2 +11,3 @@ --- | ||
* [`L.esri.Tasks.Query`]({{assets}}api-reference/tasks/query.html) | ||
* [`L.esri.Tasks.Identify`]({{assets}}api-reference/tasks/identify.html) | ||
* [`L.esri.Tasks.Identify`]({{assets}}api-reference/tasks/identify.html) | ||
* [`L.esri.Tasks.Find`]({{assets}}api-reference/tasks/find.html) |
@@ -8,4 +8,6 @@ --- | ||
`L.esri.Tasks.Query` is an abstraction for the query API that exists on Feature Layers and Map Services. It provides a chainable API for building request parameters and executing queries. | ||
`L.esri.Tasks.Query` is an abstraction for the query API that exists on Feature Layers Map Services and Image Services. It provides a chainable API for building request parameters and executing queries. | ||
**Note** Depending on the type of service you are querying (Feature Layer, Map Service, Image Service) and the version of ArcGIS Server that hosts the service some of these options my not be available. | ||
### Constructor | ||
@@ -50,3 +52,3 @@ | ||
<td><code>this</code></td> | ||
<td>Queries features a given distance in meters around a <a href="http://leafletjs.com/reference.html#latlng">LatLng</a>.</td> | ||
<td>Queries features a given distance in meters around a <a href="http://leafletjs.com/reference.html#latlng">LatLng</a>. <small>Only available for Feature Layers hosted on ArcGIS Online.</small></td> | ||
</tr> | ||
@@ -61,3 +63,3 @@ <tr> | ||
<td><code>this</code></td> | ||
<td>Define the offset of the results, when combined with `limit` can be used for paging. Available only for Feature Services hosted on ArcGIS Online.</td> | ||
<td>Define the offset of the results, when combined with `limit` can be used for paging. <small>Only available for Feature Layers hosted on ArcGIS Online.</small></td> | ||
</tr> | ||
@@ -67,3 +69,3 @@ <tr> | ||
<td><code>this</code></td> | ||
<td>Limit the number of results returned by this query, when combined with `offset` can be used for paging. Available only for Feature Services hosted on ArcGIS Online.</td> | ||
<td>Limit the number of results returned by this query, when combined with `offset` can be used for paging. <small>Only available for Feature Layers hosted on ArcGIS Online.</small></td> | ||
</tr> | ||
@@ -73,6 +75,6 @@ <tr> | ||
<td><code>this</code></td> | ||
<td>Queries features within a given time range.</td> | ||
<td>Queries features within a given time range. <small>Only available for Layers/Services with `timeInfo` in their metadata.</small></td> | ||
</tr> | ||
<tr> | ||
<td><code>fields({{{param 'Array' 'fields'}}})</code></td> | ||
<td><code>fields({{{param 'Array' 'fields'}}} or {{{param 'String' 'fields'}}})</code></td> | ||
<td><code>this</code></td> | ||
@@ -82,2 +84,7 @@ <td>An array of associated fields to request for each feature.</td> | ||
<tr> | ||
<td><code>returnGeometry({{{param 'Boolean' 'returnGeometry'}}})</code></td> | ||
<td><code>this</code></td> | ||
<td>Return geometry with results. Default is `true`.</td> | ||
</tr> | ||
<tr> | ||
<td><code>simplify({{{param 'Map' 'map' 'http://leafletjs.com/reference.html#map'}}}, {{{param 'Integer' 'factor'}}})</code></td> | ||
@@ -108,2 +115,12 @@ <td><code>this</code></td> | ||
<tr> | ||
<td><code>layer({{{param 'String or Integer' 'layer'}}})</code></td> | ||
<td><code>this</code></td> | ||
<td>Used to select which layer inside a Map Service to perform the query on. <br><small>Only available for Map Services.</small></td> | ||
</tr> | ||
<tr> | ||
<td><code>pixelSize({{{param 'Point' 'point' 'http://leafletjs.com/reference.html#point'}}})</code></td> | ||
<td><code>this</code></td> | ||
<td>Override the default pixelSize when querying an Image Service. <br><small>Only available for Image Services.</small></td> | ||
</tr> | ||
<tr> | ||
<td><code>run({{{param 'Function' 'callback'}}}, {{{param 'Object' 'context'}}})</code></td> | ||
@@ -126,3 +143,3 @@ <td><code>this</code></td> | ||
<td><code>this</code></td> | ||
<td>Exectues the query request with the current parameters, passing only the <a href="http://leafletjs.com/reference.html#latlngbounds"><code>LatLngBounds</code></a> of all features the query to callback<code>callback</code>. Accepts an optional function context.</td> | ||
<td>Exectues the query request with the current parameters, passing only the <a href="http://leafletjs.com/reference.html#latlngbounds"><code>LatLngBounds</code></a> of all features the query to callback<code>callback</code>. Accepts an optional function context. <small>Only available for Feature Layers hosted on ArcGIS Online.</small></td> | ||
</tr> | ||
@@ -129,0 +146,0 @@ </tbody> |
@@ -42,3 +42,3 @@ --- | ||
<td><code><a href="http://geojson.org/geojson-spec.html#feature-collection-objects">FeatureCollection</a></code></td> | ||
<td>Converts an API response (returned by identify and query API methods) to a <a href="http://geojson.org/geojson-spec.html#feature-collection-objects">GeoJSON FeatureCollection</a>. This is used internally by <code><a href="{{assets}}api-reference/tasks/query.html">L.esri.Service.Query</a></code> and <code><a href="{{assets}}api-reference/tasks/identify.html">L.esri.Services.Identify</a></code> to convert responses.</td> | ||
<td>Converts an API response (returned by identify, query or find API methods) to a <a href="http://geojson.org/geojson-spec.html#feature-collection-objects">GeoJSON FeatureCollection</a>. This is used internally by <code><a href="{{assets}}api-reference/tasks/query.html">L.esri.Tasks.Query</a></code>, <code><a href="{{assets}}api-reference/tasks/identify.html">L.esri.Tasks.Identify</a></code> and <code><a href="{{assets}}api-reference/tasks/find.html">L.esri.Tasks.Find</a></code> to convert responses.</td> | ||
</tr> | ||
@@ -45,0 +45,0 @@ <tr> |
@@ -11,3 +11,3 @@ --- | ||
<a href="https://github.com/Esri/esri-leaflet/releases/download/v0.0.1-beta.5/esri-leaflet-0.0.1-beta.5.zip" class="btn">Current Release</a> | ||
<a href="https://github.com/Esri/esri-leaflet/releases/download/v0.0.1-beta.6/esri-leaflet-v0.0.1-beta.6.zip" class="btn">Current Release</a> | ||
<a href="https://github.com/Esri/esri-leaflet/releases/" class="btn">Past Releases</a> | ||
@@ -22,3 +22,3 @@ | ||
```xml | ||
<script src="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet/0.0.1-beta.5/esri-leaflet.js"></script> | ||
<script src="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet/0.0.1-beta.6/esri-leaflet.js"></script> | ||
``` | ||
@@ -32,22 +32,22 @@ | ||
<!-- Core Build --> | ||
<script src="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet/0.0.1-beta.5/esri-leaflet-core.js"></script> | ||
<script src="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet/0.0.1-beta.6/esri-leaflet-core.js"></script> | ||
<!-- Basemaps Only Build --> | ||
<script src="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet/0.0.1-beta.5/esri-leaflet-basemaps.js"></script> | ||
<script src="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet/0.0.1-beta.6/esri-leaflet-basemaps.js"></script> | ||
<!-- Feature Layer Only Build --> | ||
<script src="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet/0.0.1-beta.5/esri-leaflet-feature-layer.js"></script> | ||
<script src="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet/0.0.1-beta.6/esri-leaflet-feature-layer.js"></script> | ||
<!-- Map Service Only Build --> | ||
<script src="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet/0.0.1-beta.5/esri-leaflet-map-service.js"></script> | ||
<script src="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet/0.0.1-beta.6/esri-leaflet-map-service.js"></script> | ||
<!-- Heatmap Feature Layer --> | ||
<script src="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet/0.0.1-beta.5/esri-leaflet-heatmap-feature-layer.js"></script> | ||
<script src="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet/0.0.1-beta.6/esri-leaflet-heatmap-feature-layer.js"></script> | ||
<!-- Clustered Feature Layer --> | ||
<script src="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet/0.0.1-beta.5/esri-leaflet-clustered-feature-layer.js"></script> | ||
<script src="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet/0.0.1-beta.6/esri-leaflet-clustered-feature-layer.js"></script> | ||
<!-- Geocoding Control --> | ||
<script src="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet-geocoder/0.0.1-beta.3/esri-leaflet-geocoder.js"></script> | ||
<link rel="stylesheet" type="text/css" href="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet-geocoder/0.0.1-beta.3/esri-leaflet-geocoder.css"> | ||
<script src="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet-geocoder/0.0.1-beta.6/esri-leaflet-geocoder.js"></script> | ||
<link rel="stylesheet" type="text/css" href="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet-geocoder/0.0.1-beta.6/esri-leaflet-geocoder.css"> | ||
``` | ||
@@ -59,18 +59,21 @@ | ||
| Feature | Standard | Core | MapService | FeatureLayer | Basemaps | ClusteredFeatureLayer | HeatmapFeatureLayer | | ||
| --- | --- | --- | --- | --- | --- | --- | --- | | ||
| Size | 37.5kb | 7.7kb | 11.8kb | 23kb | 8.3kb | 3.w2kb | 1.5kb | | ||
| Gzipped | 6.38kb | 1.6kb | 2.23kb | 4.3kb | 1.5kb | 0.6kb | 0.3kb | | ||
| `L.esri.Request` | ✓ | ✓ | ✓ | ✓ | ✓ | | | | ||
| `L.esri.Util` | ✓ | ✓ | ✓ | ✓ | | | | | ||
| `L.esri.Services.Service` | ✓ | ✓ | ✓ | ✓ | | | | | ||
| `L.esri.Services.MapService` | ✓ | | ✓ | | | | | | ||
| `L.esri.Services.FeatureLayer` | ✓ | | | ✓ | | | | | ||
| `L.esri.Tasks.Query` | ✓ | | | ✓ | | | | | ||
| `L.esri.Tasks.Identify` | ✓ | | ✓ | | | | | | ||
| `L.esri.Layers.FeatureLayer` | ✓ | | | ✓ | | | | | ||
| `L.esri.Layers.DynamicMapLayer` | ✓ | | ✓ | | | | | | ||
| `L.esri.Layers.TiledMapLayer` | ✓ | | ✓ | | | | | | ||
| `L.esri.Layers.BasemapLayer` | ✓ | | | | ✓ | | | | ||
| `L.esri.Layers.ClusteredFeatureLayer` | | | | | | ✓ | | | ||
| `L.esri.Layers.HeatMapFeatureLayer` | | | | | | | ✓ | | ||
| Feature | Standard | Core | MapService | ImageService | FeatureLayer | Basemaps | ClusteredFeatureLayer | HeatmapFeatureLayer | | ||
| -------------------------------------- | -------- | -------- | ---------- | ------------ | ------------ | -------- | --------------------- | ------------------- | | ||
| Size | 46.8kb | 7.7kb | 20.1kb | 17.5kb | 23.3kb | 8.9kb | 3.4kb | 1.5kb | | ||
| Gzipped | 7.3kb | 1.6kb | 3.5kb | 3.2kb | 4.3kb | 1.6kb | 0.6kb | 0.3kb | | ||
| `L.esri.Request` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | | ||
| `L.esri.Util` | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | ||
| `L.esri.Services.Service` | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | ||
| `L.esri.Services.MapService` | ✓ | | ✓ | | | | | | | ||
| `L.esri.Services.FeatureLayer` | ✓ | | | | ✓ | | | | | ||
| `L.esri.Tasks.Query` | ✓ | | ✓ | ✓ | ✓ | | | | | ||
| `L.esri.Tasks.Find` | ✓ | | ✓ | | | | | | | ||
| `L.esri.Tasks.IdentifyFeatures` | ✓ | | ✓ | | | | | | | ||
| `L.esri.Tasks.IdentifyImage` | ✓ | | | ✓ | | | | | | ||
| `L.esri.Layers.FeatureLayer` | ✓ | | | | ✓ | | | | | ||
| `L.esri.Layers.ImageMapLayer` | ✓ | | | ✓ | | | | | | ||
| `L.esri.Layers.DynamicMapLayer` | ✓ | | ✓ | | | | | | | ||
| `L.esri.Layers.TiledMapLayer` | ✓ | | ✓ | | | | | | | ||
| `L.esri.Layers.BasemapLayer` | ✓ | | | | | ✓ | | | | ||
| `L.esri.Layers.ClusteredFeatureLayer` | | | | | | | ✓ | | | ||
| `L.esri.Layers.HeatMapFeatureLayer` | | | | | | | | | |
@@ -64,2 +64,9 @@ describe('L.esri.Layers.ClusteredFeatureLayer', function () { | ||
it('should fire a removefeature event', function(){ | ||
layer.on('removefeature', function(e){ | ||
expect(e.feature.id).to.equal(1); | ||
}); | ||
layer.removeLayers([1]); | ||
}); | ||
it('should add features back to a cluster', function(){ | ||
@@ -73,2 +80,10 @@ layer.removeLayers([1]); | ||
it('should fire a addfeature event', function(){ | ||
layer.on('addfeature', function(e){ | ||
expect(e.feature.id).to.equal(1); | ||
}); | ||
layer.removeLayers([1]); | ||
layer.addLayers([1]); | ||
}); | ||
it('should not add features outside the time range', function(){ | ||
@@ -75,0 +90,0 @@ layer.setTimeRange(new Date('January 1 2014'), new Date('Febuary 1 2014')); |
@@ -66,2 +66,10 @@ describe('L.esri.Layers.DynamicMapLayer', function () { | ||
it('should display an attribution if one was passed', function(){ | ||
L.esri.Layers.dynamicMapLayer(url, { | ||
attribution: 'Esri' | ||
}).addTo(map); | ||
expect(map.attributionControl._container.innerText).to.contain('Esri'); | ||
}); | ||
it('will fire a loading event when it starts loading', function(done){ | ||
@@ -130,7 +138,7 @@ layer.on('loading', function(e){ | ||
it('should expose the query method on the underlying service', function(){ | ||
it('should expose the identify method on the underlying service', function(){ | ||
var spy = sinon.spy(layer._service, 'identify'); | ||
var identify = layer.identify(); | ||
expect(spy).to.have.been.calledWith(layer.service); | ||
expect(identify).to.be.an.instanceof(L.esri.Tasks.Identify); | ||
expect(identify).to.be.an.instanceof(L.esri.Tasks.IdentifyFeatures); | ||
expect(identify._service).to.equal(layer._service); | ||
@@ -222,4 +230,4 @@ }); | ||
layer.setTimeRange(new Date('January 9 2014'), new Date('January 12 2014')); | ||
expect(layer.getTimeRange()).to.deep.equal([new Date('January 9 2014'), new Date('January 12 2014')]); | ||
layer.setTimeRange(new Date('January 9 2014 GMT-0800'), new Date('January 12 2014 GMT-0800')); | ||
expect(layer.getTimeRange()).to.deep.equal([new Date('January 9 2014 GMT-0800'), new Date('January 12 2014 GMT-0800')]); | ||
layer.addTo(map); | ||
@@ -239,4 +247,4 @@ server.respond(); | ||
layer.setTimeRange(new Date('January 9 2014'), new Date('January 12 2014')); | ||
expect(layer.getTimeRange()).to.deep.equal([new Date('January 9 2014'), new Date('January 12 2014')]); | ||
layer.setTimeRange(new Date('January 9 2014 GMT-0800'), new Date('January 12 2014 GMT-0800')); | ||
expect(layer.getTimeRange()).to.deep.equal([new Date('January 9 2014 GMT-0800'), new Date('January 12 2014 GMT-0800')]); | ||
layer.setTimeOptions({ foo: 'bar' }); | ||
@@ -288,3 +296,3 @@ expect(layer.getTimeOptions()).to.deep.equal({ foo: 'bar' }); | ||
it('should bind a popup to the layer', function(){ | ||
server.respondWith('GET', new RegExp(/http:\/\/services.arcgis.com\/mock\/arcgis\/rest\/services\/MockMapService\/MapServer\/identify\?sr=4326&layers=all&tolerance=3&imageDisplay=500%2C500%2C96&mapExtent=-?\d+\.\d+%2C-?\d+\.\d+%2C-?\d+\.\d+%2C-?\d+\.\d+&geometry=-?\d+\.\d+%2C-?\d+\.\d+&geometryType=esriGeometryPoint&f=json/), JSON.stringify(sampleResponse)); | ||
server.respondWith('GET', new RegExp(/http:\/\/services.arcgis.com\/mock\/arcgis\/rest\/services\/MockMapService\/MapServer\/identify\?sr=4326&layers=all&tolerance=3&returnGeometry=true&imageDisplay=500%2C500%2C96&mapExtent=-?\d+\.\d+%2C-?\d+\.\d+%2C-?\d+\.\d+%2C-?\d+\.\d+&geometry=-?\d+\.\d+%2C-?\d+\.\d+&geometryType=esriGeometryPoint&f=json/), JSON.stringify(sampleResponse)); | ||
@@ -310,3 +318,4 @@ layer.bindPopup(function(error, featureCollection){ | ||
it('should bind a popup to the layer if the layer is already on a map', function(){ | ||
server.respondWith('GET', new RegExp(/http:\/\/services.arcgis.com\/mock\/arcgis\/rest\/services\/MockMapService\/MapServer\/identify\?sr=4326&layers=all&tolerance=3&imageDisplay=500%2C500%2C96&mapExtent=-?\d+\.\d+%2C-?\d+\.\d+%2C-?\d+\.\d+%2C-?\d+\.\d+&geometry=-?\d+\.\d+%2C-?\d+\.\d+&geometryType=esriGeometryPoint&f=json/), JSON.stringify(sampleResponse)); | ||
server.respondWith('GET', new RegExp(/http:\/\/services.arcgis.com\/mock\/arcgis\/rest\/services\/MockMapService\/MapServer\/identify\?sr=4326&layers=all&tolerance=3&returnGeometry=true&imageDisplay=500%2C500%2C96&mapExtent=-?\d+\.\d+%2C-?\d+\.\d+%2C-?\d+\.\d+%2C-?\d+\.\d+&geometry=-?\d+\.\d+%2C-?\d+\.\d+&geometryType=esriGeometryPoint&f=json/), JSON.stringify(sampleResponse)); | ||
layer.addTo(map); | ||
@@ -313,0 +322,0 @@ |
@@ -53,2 +53,18 @@ describe('L.esri.Layers.FeatureLayer', function () { | ||
it('should fire a createfeature event', function(done){ | ||
layer = L.esri.featureLayer('http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0', { | ||
timeField: 'time', | ||
pointToLayer: function(feature, latlng){ | ||
return L.circleMarker(latlng); | ||
} | ||
}).addTo(map); | ||
layer.on('createfeature', function(e){ | ||
expect(e.feature.id).to.equal(2); | ||
done(); | ||
}); | ||
layer.createLayers(features); | ||
}); | ||
it('should have an alias at L.esri.Layers.featureLayer', function(){ | ||
@@ -70,2 +86,9 @@ var layer = L.esri.Layers.featureLayer('http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0'); | ||
it('should fire a removefeature event', function(){ | ||
layer.on('removefeature', function(e){ | ||
expect(e.feature.id).to.equal(1); | ||
}); | ||
layer.removeLayers([1]); | ||
}); | ||
it('should add features back to a map', function(){ | ||
@@ -78,2 +101,10 @@ layer.removeLayers([1]); | ||
it('should fire a addfeature event', function(){ | ||
layer.on('addfeature', function(e){ | ||
expect(e.feature.id).to.equal(1); | ||
}); | ||
layer.removeLayers([1]); | ||
layer.addLayers([1]); | ||
}); | ||
it('should readd features back to a map', function(){ | ||
@@ -202,15 +233,2 @@ map.removeLayer(layer.getFeature(1)); | ||
it('should add features to the map when their cell enters the view', function(){ | ||
layer._cache['1:1'] = [1]; | ||
map.removeLayer(layer.getFeature(1)); | ||
layer.cellEnter(null, L.point([1,1])); | ||
expect(map.hasLayer(layer.getFeature(1))).to.equal(true); | ||
}); | ||
it('should remove features to the map when their cell leaves the view', function(){ | ||
layer._cache['1:1'] = [1]; | ||
layer.cellLeave(null, L.point([1,1])); | ||
expect(map.hasLayer(layer.getFeature(1))).to.equal(false); | ||
}); | ||
it('should propagate events from individual features', function(){ | ||
@@ -217,0 +235,0 @@ var spy = sinon.spy(); |
@@ -84,3 +84,3 @@ describe('L.esri.Layers.FeatureManager', function () { | ||
'Type': 'Active', | ||
'Time': new Date('January 1 2014').valueOf() | ||
'Time': new Date('January 1 2014 GMT-0800').valueOf() | ||
}, | ||
@@ -101,3 +101,3 @@ 'geometry': { | ||
'Type': 'Inactive', | ||
'Time': new Date('January 15 2014').valueOf() | ||
'Time': new Date('January 15 2014 GMT-0800').valueOf() | ||
}, | ||
@@ -118,3 +118,3 @@ 'geometry': { | ||
'Type': 'Active', | ||
'Time': new Date('January 12 2014').valueOf() | ||
'Time': new Date('January 12 2014 GMT-0800').valueOf() | ||
}, | ||
@@ -135,4 +135,4 @@ 'geometry': { | ||
'Type': 'Inactive', | ||
'StartTime': new Date('January 10 2014').valueOf(), | ||
'EndTime': new Date('January 11 2014').valueOf() | ||
'StartTime': new Date('January 10 2014 GMT-0800').valueOf(), | ||
'EndTime': new Date('January 11 2014 GMT-0800').valueOf() | ||
}, | ||
@@ -153,4 +153,4 @@ 'geometry': { | ||
'Type': 'Active', | ||
'StartTime': new Date('January 14 2014').valueOf(), | ||
'EndTime': new Date('January 15 2014').valueOf() | ||
'StartTime': new Date('January 14 2014 GMT-0800').valueOf(), | ||
'EndTime': new Date('January 15 2014 GMT-0800').valueOf() | ||
}, | ||
@@ -171,4 +171,4 @@ 'geometry': { | ||
'Type': 'Active', | ||
'StartTime': new Date('January 14 2014').valueOf(), | ||
'EndTime': new Date('January 15 2014').valueOf() | ||
'StartTime': new Date('January 14 2014 GMT-0800').valueOf(), | ||
'EndTime': new Date('January 15 2014 GMT-0800').valueOf() | ||
}, | ||
@@ -204,3 +204,3 @@ 'geometry': { | ||
it('should create features based on the current view of the map', function(){ | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&f=json', JSON.stringify({ | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&inSr=4326&geometryPrecision=6&f=json', JSON.stringify({ | ||
fields: fields, | ||
@@ -226,3 +226,3 @@ features: [feature1, feature2], | ||
'Type': 'Inactive', | ||
'Time': new Date('January 15 2014').valueOf() | ||
'Time': new Date('January 15 2014 GMT-0800').valueOf() | ||
}, | ||
@@ -241,3 +241,3 @@ 'id': 2 | ||
'Type': 'Active', | ||
'Time': new Date('January 1 2014').valueOf() | ||
'Time': new Date('January 1 2014 GMT-0800').valueOf() | ||
}, | ||
@@ -250,3 +250,3 @@ 'id': 1 | ||
it('should fire a drawlimitexceeded event when there are more features then can be requested', function(done){ | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&f=json', JSON.stringify({ | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&inSr=4326&geometryPrecision=6&f=json', JSON.stringify({ | ||
fields: fields, | ||
@@ -269,3 +269,3 @@ features: [], | ||
it('should filter existing features with a single time field', function(){ | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&f=json', JSON.stringify({ | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&inSr=4326&geometryPrecision=6&f=json', JSON.stringify({ | ||
fields: fields, | ||
@@ -280,3 +280,3 @@ features: [feature2, feature3], | ||
layer.setTimeRange(new Date('January 11 2014'), new Date('January 13 2014')); | ||
layer.setTimeRange(new Date('January 11 2014 GMT-0800'), new Date('January 13 2014 GMT-0800')); | ||
@@ -286,3 +286,3 @@ expect(layer.removeLayers).to.have.been.calledWith([2]); | ||
layer.setTimeRange(new Date('January 14 2014'), new Date('January 16 2014')); | ||
layer.setTimeRange(new Date('January 14 2014 GMT-0800'), new Date('January 16 2014 GMT-0800')); | ||
@@ -294,3 +294,3 @@ expect(layer.removeLayers).to.have.been.calledWith([3]); | ||
it('should load more features with a single time field', function(){ | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&time=1385884800000%2C1389340800000&f=json', JSON.stringify({ | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&inSr=4326&geometryPrecision=6&time=1385884800000%2C1389340800000&f=json', JSON.stringify({ | ||
fields: fields, | ||
@@ -301,3 +301,3 @@ features: [feature1], | ||
layer.setTimeRange(new Date('Dec 1 2013'), new Date('January 10 2014')); | ||
layer.setTimeRange(new Date('Dec 1 2013 GMT-0800'), new Date('January 10 2014 GMT-0800')); | ||
@@ -318,3 +318,3 @@ layer.addTo(map); | ||
'Type': 'Active', | ||
'Time': new Date('January 1 2014').valueOf() | ||
'Time': new Date('January 1 2014 GMT-0800').valueOf() | ||
}, | ||
@@ -324,3 +324,3 @@ 'id': 1 | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&time=1389686400000%2C1389859200000&f=json', JSON.stringify({ | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&inSr=4326&geometryPrecision=6&time=1389686400000%2C1389859200000&f=json', JSON.stringify({ | ||
fields: fields, | ||
@@ -331,3 +331,3 @@ features: [feature2], | ||
layer.setTimeRange(new Date('January 14 2014'), new Date('January 16 2014')); | ||
layer.setTimeRange(new Date('January 14 2014 GMT-0800'), new Date('January 16 2014 GMT-0800')); | ||
@@ -348,3 +348,3 @@ server.respond(); | ||
'Type': 'Inactive', | ||
'Time': new Date('January 15 2014').valueOf() | ||
'Time': new Date('January 15 2014 GMT-0800').valueOf() | ||
}, | ||
@@ -363,3 +363,3 @@ 'id': 2 | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&f=json', JSON.stringify({ | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&inSr=4326&geometryPrecision=6&f=json', JSON.stringify({ | ||
fields: fields, | ||
@@ -374,3 +374,3 @@ features: [feature4, feature5], | ||
layer.setTimeRange(new Date('January 9 2014'), new Date('January 12 2014')); | ||
layer.setTimeRange(new Date('January 9 2014 GMT-0800'), new Date('January 12 2014 GMT-0800')); | ||
@@ -380,3 +380,3 @@ expect(layer.removeLayers).to.have.been.calledWith([5]); | ||
layer.setTimeRange(new Date('January 13 2014'), new Date('January 16 2014')); | ||
layer.setTimeRange(new Date('January 13 2014 GMT-0800'), new Date('January 16 2014 GMT-0800')); | ||
@@ -395,3 +395,3 @@ expect(layer.removeLayers).to.have.been.calledWith([4, 4]); | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&time=1389254400000%2C1389513600000&f=json', JSON.stringify({ | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&inSr=4326&geometryPrecision=6&time=1389254400000%2C1389513600000&f=json', JSON.stringify({ | ||
fields: fields, | ||
@@ -402,3 +402,3 @@ features: [feature4], | ||
layer.setTimeRange(new Date('January 9 2014'), new Date('January 12 2014')); | ||
layer.setTimeRange(new Date('January 9 2014 GMT-0800'), new Date('January 12 2014 GMT-0800')); | ||
layer.addTo(map); | ||
@@ -418,4 +418,4 @@ | ||
'Type': 'Inactive', | ||
'StartTime': new Date('January 10 2014').valueOf(), | ||
'EndTime': new Date('January 11 2014').valueOf() | ||
'StartTime': new Date('January 10 2014 GMT-0800').valueOf(), | ||
'EndTime': new Date('January 11 2014 GMT-0800').valueOf() | ||
}, | ||
@@ -425,3 +425,3 @@ 'type': 'Feature' | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&time=1389600000000%2C1389859200000&f=json', JSON.stringify({ | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&inSr=4326&geometryPrecision=6&time=1389600000000%2C1389859200000&f=json', JSON.stringify({ | ||
fields: fields, | ||
@@ -432,3 +432,3 @@ features: [feature5], | ||
layer.setTimeRange(new Date('January 13 2014'), new Date('January 16 2014')); | ||
layer.setTimeRange(new Date('January 13 2014 GMT-0800'), new Date('January 16 2014 GMT-0800')); | ||
@@ -449,4 +449,4 @@ server.respond(); | ||
'Type': 'Active', | ||
'StartTime': new Date('January 14 2014').valueOf(), | ||
'EndTime': new Date('January 15 2014').valueOf() | ||
'StartTime': new Date('January 14 2014 GMT-0800').valueOf(), | ||
'EndTime': new Date('January 15 2014 GMT-0800').valueOf() | ||
}, | ||
@@ -458,3 +458,3 @@ 'type': 'Feature' | ||
it('should filter features with a where parameter', function(){ | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?where=Type%3D\'Active\'&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&f=json', JSON.stringify({ | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=Type%3D\'Active\'&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&inSr=4326&geometryPrecision=6&f=json', JSON.stringify({ | ||
fields: fields, | ||
@@ -465,3 +465,3 @@ features: [feature1], | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?where=Type%3D\'Inactive\'&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&f=json', JSON.stringify({ | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=Type%3D\'Inactive\'&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&inSr=4326&geometryPrecision=6&f=json', JSON.stringify({ | ||
fields: fields, | ||
@@ -487,3 +487,3 @@ features: [feature2], | ||
'Type': 'Active', | ||
'Time': new Date('January 1 2014').valueOf() | ||
'Time': new Date('January 1 2014 GMT-0800').valueOf() | ||
}, | ||
@@ -508,3 +508,3 @@ 'id': 1 | ||
'Type': 'Inactive', | ||
'Time': new Date('January 15 2014').valueOf() | ||
'Time': new Date('January 15 2014 GMT-0800').valueOf() | ||
}, | ||
@@ -516,3 +516,3 @@ 'id': 2 | ||
it('should return true for features with a single time field in the current time range', function(){ | ||
layer.setTimeRange(new Date('Dec 1 2013'), new Date('January 10 2014')); | ||
layer.setTimeRange(new Date('Dec 1 2013 GMT-0800'), new Date('January 10 2014 GMT-0800')); | ||
@@ -529,3 +529,3 @@ expect(layer._featureWithinTimeRange({ | ||
'Type': 'Active', | ||
'Time': new Date('January 1 2014').valueOf() | ||
'Time': new Date('January 1 2014 GMT-0800').valueOf() | ||
}, | ||
@@ -545,3 +545,3 @@ 'id': 1 | ||
'Type': 'Inactive', | ||
'Time': new Date('January 15 2014').valueOf() | ||
'Time': new Date('January 15 2014 GMT-0800').valueOf() | ||
}, | ||
@@ -554,4 +554,4 @@ 'id': 2 | ||
var layer = new L.esri.Layers.FeatureManager(url, { | ||
from: new Date('Dec 1 2013'), | ||
to: new Date('January 12 2014'), | ||
from: new Date('Dec 1 2013 GMT-0800'), | ||
to: new Date('January 12 2014 GMT-0800'), | ||
timeField: { | ||
@@ -573,4 +573,4 @@ start: 'StartTime', | ||
'Type': 'Active', | ||
'StartTime': new Date('January 10 2014').valueOf(), | ||
'EndTime': new Date('January 11 2014').valueOf() | ||
'StartTime': new Date('January 10 2014 GMT-0800').valueOf(), | ||
'EndTime': new Date('January 11 2014 GMT-0800').valueOf() | ||
}, | ||
@@ -590,4 +590,4 @@ 'id': 1 | ||
'Type': 'Inactive', | ||
'StartTime': new Date('January 14 2014').valueOf(), | ||
'EndTime': new Date('January 15 2014').valueOf() | ||
'StartTime': new Date('January 14 2014 GMT-0800').valueOf(), | ||
'EndTime': new Date('January 15 2014 GMT-0800').valueOf() | ||
}, | ||
@@ -609,4 +609,4 @@ 'id': 2 | ||
'Type': 'Active', | ||
'StartTime': new Date('January 10 2014').valueOf(), | ||
'EndTime': new Date('January 11 2014').valueOf() | ||
'StartTime': new Date('January 10 2014 GMT-0800').valueOf(), | ||
'EndTime': new Date('January 11 2014 GMT-0800').valueOf() | ||
}, | ||
@@ -618,4 +618,4 @@ 'id': 1 | ||
it('should be able to get the time range', function(){ | ||
layer.setTimeRange(new Date('January 13 2014'), new Date('January 16 2014')); | ||
expect(layer.getTimeRange()).to.deep.equal([new Date('January 13 2014'), new Date('January 16 2014')]); | ||
layer.setTimeRange(new Date('January 13 2014 GMT-0800'), new Date('January 16 2014 GMT-0800')); | ||
expect(layer.getTimeRange()).to.deep.equal([new Date('January 13 2014 GMT-0800'), new Date('January 16 2014 GMT-0800')]); | ||
}); | ||
@@ -738,3 +738,3 @@ | ||
it('should support generalizing geometries', function(){ | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&maxAllowableOffset=0.00004291534423829546&f=json', JSON.stringify({ | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&inSr=4326&geometryPrecision=6&maxAllowableOffset=0.00004291534423829546&f=json', JSON.stringify({ | ||
fields: fields, | ||
@@ -771,4 +771,4 @@ features: [feature6], | ||
'Type': 'Active', | ||
'StartTime': new Date('January 14 2014').valueOf(), | ||
'EndTime': new Date('January 15 2014').valueOf() | ||
'StartTime': new Date('January 14 2014 GMT-0800').valueOf(), | ||
'EndTime': new Date('January 15 2014 GMT-0800').valueOf() | ||
}, | ||
@@ -780,3 +780,3 @@ 'id': 6 | ||
it('should propagate events from the service', function(){ | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&f=json', JSON.stringify({ | ||
server.respondWith('GET', 'http://services.arcgis.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0/query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.6953125%2C%22ymin%22%3A45.521743896993634%2C%22xmax%22%3A-122.6513671875%2C%22ymax%22%3A45.55252525134013%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&f=json', JSON.stringify({ | ||
fields: fields, | ||
@@ -801,2 +801,10 @@ features: [], | ||
}); | ||
it('should display an attribution if one was passed', function(){ | ||
L.esri.Layers.imageMapLayer(url, { | ||
attribution: 'Esri' | ||
}).addTo(map); | ||
expect(map.attributionControl._container.innerText).to.contain('Esri'); | ||
}); | ||
}); |
@@ -35,3 +35,3 @@ describe('L.esri.Layers.TiledMapLayer', function () { | ||
expect(spy).to.have.been.calledWith(layer.service); | ||
expect(identify).to.be.an.instanceof(L.esri.Tasks.Identify); | ||
expect(identify).to.be.an.instanceof(L.esri.Tasks.IdentifyFeatures); | ||
expect(identify._service).to.equal(layer._service); | ||
@@ -38,0 +38,0 @@ }); |
@@ -53,2 +53,25 @@ describe('L.esri.Services.FeatureLayer', function () { | ||
it('should be able to add a feature to the layer without a callback', function(){ | ||
expect(function(){ | ||
service.addFeature({ | ||
type: 'Feature', | ||
geometry: { | ||
type: 'Point', | ||
coordinates: [45, -121] | ||
}, | ||
properties: { | ||
foo: 'bar' | ||
} | ||
}); | ||
}).to.not.throw(Error); | ||
requests[0].respond(200, { 'Content-Type': 'text/plain; charset=utf-8' }, JSON.stringify({ | ||
'addResults' : [{ | ||
'objectId' : 1, | ||
'success' : true | ||
}] | ||
})); | ||
}); | ||
it('should be able to update a feature on the layer', function(){ | ||
@@ -86,2 +109,26 @@ var callback = sinon.spy(); | ||
it('should be able to update a feature on the layer without a callback', function(){ | ||
expect(function(){ | ||
service.updateFeature({ | ||
type: 'Feature', | ||
id: 1, | ||
geometry: { | ||
type: 'Point', | ||
coordinates: [45, -121] | ||
}, | ||
properties: { | ||
foo: 'bar' | ||
} | ||
}); | ||
}).to.not.throw(Error); | ||
requests[0].respond(200, { 'Content-Type': 'text/plain; charset=utf-8' }, JSON.stringify({ | ||
'updateResults' : [{ | ||
'objectId' : 1, | ||
'success' : true | ||
}] | ||
})); | ||
}); | ||
it('should be able to remove features from the layer', function(){ | ||
@@ -108,2 +155,15 @@ var callback = sinon.spy(); | ||
}); | ||
it('should be able to remove features from the layer without a callback', function(){ | ||
expect(function(){ | ||
service.deleteFeature(1); | ||
}).to.not.throw(Error); | ||
requests[0].respond(200, { 'Content-Type': 'text/plain; charset=utf-8' }, JSON.stringify({ | ||
'deleteResults' : [{ | ||
'objectId' : 1, | ||
'success' : true | ||
}] | ||
})); | ||
}); | ||
}); |
@@ -23,7 +23,112 @@ describe('L.esri.Tasks.Query', function () { | ||
var url = 'http://services.arcgis.com/mock/arcgis/rest/services/MockFeatureService/FeatureServer/0/'; | ||
var featureLayerUrl = 'http://services.arcgis.com/mock/arcgis/rest/services/MockFeatureService/FeatureServer/0/'; | ||
var mapServiceUrl = 'http://services.arcgis.com/mock/arcgis/rest/services/MockMapService/MapServer/'; | ||
var imageServiceUrl = 'http://services.arcgis.com/mock/arcgis/rest/services/MockImageService/ImageServer/'; | ||
var sampleImageServiceQueryResponse = { | ||
'fieldAliases': { | ||
'IMAGEID': 'IMAGEID', | ||
'OWNER': 'OWNER' | ||
}, | ||
'fields': [ | ||
{ | ||
'name': 'IMAGEID', | ||
'type': 'esriFieldTypeOID', | ||
'alias': 'IMAGEID' | ||
}, | ||
{ | ||
'name': 'OWNER', | ||
'type': 'esriFieldTypeString', | ||
'alias': 'OWNER' | ||
}, | ||
], | ||
'features': [ | ||
{ | ||
'attributes': { | ||
'IMAGEID': 1, | ||
'OWNER': 'Joe Smith' | ||
}, | ||
'geometry': { | ||
'rings' : [ | ||
[ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832], [-97.06138,32.837] ] | ||
], | ||
'spatialReference': { | ||
'wkid': 4326 | ||
} | ||
} | ||
} | ||
] | ||
}; | ||
var sampleImageServiceCollection = { | ||
'type': 'FeatureCollection', | ||
'features': [{ | ||
'type': 'Feature', | ||
'geometry': { | ||
'type': 'Polygon', | ||
'coordinates': [ | ||
[ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832], [-97.06138,32.837] ] | ||
] | ||
}, | ||
'properties': { | ||
'IMAGEID': 1, | ||
'OWNER': 'Joe Smith' | ||
}, | ||
'id': 1 | ||
}] | ||
}; | ||
var sampleMapServiceQueryResponse = { | ||
'fieldAliases': { | ||
'ObjectID': 'ObjectID', | ||
'Name': 'Name' | ||
}, | ||
'fields': [ | ||
{ | ||
'name': 'ObjectID', | ||
'type': 'esriFieldTypeOID', | ||
'alias': 'ObjectID' | ||
}, | ||
{ | ||
'name': 'Name', | ||
'type': 'esriFieldTypeString', | ||
'alias': 'Name' | ||
}, | ||
], | ||
'features': [ | ||
{ | ||
'attributes': { | ||
'ObjectID': 1, | ||
'Name': 'Site' | ||
}, | ||
'geometry': { | ||
'x': -122.81, | ||
'y': 45.48, | ||
'spatialReference': { | ||
'wkid': 4326 | ||
} | ||
} | ||
} | ||
] | ||
}; | ||
var sampleMapServiceCollection = { | ||
'type': 'FeatureCollection', | ||
'features': [{ | ||
'type': 'Feature', | ||
'geometry': { | ||
'type': 'Point', | ||
'coordinates': [-122.81, 45.48] | ||
}, | ||
'properties': { | ||
'ObjectID': 1, | ||
'Name': 'Site' | ||
}, | ||
'id': 1 | ||
}] | ||
}; | ||
var sampleQueryResponse = { | ||
'objectIdFieldName': 'FID', | ||
'feilds': [{ | ||
'fields': [{ | ||
'name': 'stop_desc', | ||
@@ -97,3 +202,3 @@ 'type': 'esriFieldTypeString', | ||
server = sinon.fakeServer.create(); | ||
task = L.esri.Tasks.query(url); | ||
task = L.esri.Tasks.query(featureLayerUrl); | ||
}); | ||
@@ -106,3 +211,3 @@ | ||
it('should query features', function(done){ | ||
server.respondWith('GET', url + 'query?where=1%3D1&outSr=4326&outFields=*&f=json', JSON.stringify(sampleQueryResponse)); | ||
server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&f=json', JSON.stringify(sampleQueryResponse)); | ||
@@ -119,3 +224,3 @@ task.run(function(error, featureCollection, raw){ | ||
it('should query features within bounds', function(done){ | ||
server.respondWith('GET', url + 'query?where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.66%2C%22ymin%22%3A45.5%2C%22xmax%22%3A-122.65%2C%22ymax%22%3A45.51%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&f=json', JSON.stringify(sampleQueryResponse)); | ||
server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&geometry=%7B%22xmin%22%3A-122.66%2C%22ymin%22%3A45.5%2C%22xmax%22%3A-122.65%2C%22ymax%22%3A45.51%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&inSr=4326&f=json', JSON.stringify(sampleQueryResponse)); | ||
@@ -132,3 +237,3 @@ task.within(bounds).run(function(error, featureCollection, raw){ | ||
it('should query features near a latlng', function(done){ | ||
server.respondWith('GET', url + 'query?where=1%3D1&outSr=4326&outFields=*&geometry=-122.66%2C45.51&geometryType=esriGeometryPoint&spatialRel=esriSpatialRelIntersects&units=esriSRUnit_Meter&distance=500&inSr=4326&f=json', JSON.stringify(sampleQueryResponse)); | ||
server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&geometry=-122.66%2C45.51&geometryType=esriGeometryPoint&spatialRel=esriSpatialRelIntersects&units=esriSRUnit_Meter&distance=500&inSr=4326&f=json', JSON.stringify(sampleQueryResponse)); | ||
@@ -145,3 +250,3 @@ task.nearby(latlng, 500).run(function(error, featureCollection, raw){ | ||
it('should query features with a where option', function(done){ | ||
server.respondWith('GET', url + 'query?where=NAME%3D\'Site\'&outSr=4326&outFields=*&f=json', JSON.stringify(sampleQueryResponse)); | ||
server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=NAME%3D\'Site\'&outSr=4326&outFields=*&f=json', JSON.stringify(sampleQueryResponse)); | ||
@@ -158,3 +263,3 @@ task.where('NAME="Site"').run(function(error, featureCollection, raw){ | ||
it('should limit queries for pagination', function(done){ | ||
server.respondWith('GET', url + 'query?where=1%3D1&outSr=4326&outFields=*&limit=10&f=json', JSON.stringify(sampleQueryResponse)); | ||
server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&limit=10&f=json', JSON.stringify(sampleQueryResponse)); | ||
@@ -171,3 +276,3 @@ task.limit(10).run(function(error, featureCollection, raw){ | ||
it('should offset queries for pagination', function(done){ | ||
server.respondWith('GET', url + 'query?where=1%3D1&outSr=4326&outFields=*&offset=10&f=json', JSON.stringify(sampleQueryResponse)); | ||
server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&offset=10&f=json', JSON.stringify(sampleQueryResponse)); | ||
@@ -184,6 +289,6 @@ task.offset(10).run(function(error, featureCollection, raw){ | ||
it('should query features in a given time range', function(done){ | ||
server.respondWith('GET', url + 'query?where=1%3D1&outSr=4326&outFields=*&time=1357027200000%2C1388563200000&f=json', JSON.stringify(sampleQueryResponse)); | ||
server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&time=1357027200000%2C1388563200000&f=json', JSON.stringify(sampleQueryResponse)); | ||
var start = new Date('January 1 2013'); | ||
var end = new Date('January 1 2014'); | ||
var start = new Date('January 1 2013 GMT-0800'); | ||
var end = new Date('January 1 2014 GMT-0800'); | ||
@@ -200,3 +305,3 @@ task.between(start, end).run(function(error, featureCollection, raw){ | ||
it('should set output fields for queries', function(done){ | ||
server.respondWith('GET', url + 'query?where=1%3D1&outSr=4326&outFields=Name%2CFID&f=json', JSON.stringify(sampleQueryResponse)); | ||
server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=Name%2CFID&f=json', JSON.stringify(sampleQueryResponse)); | ||
@@ -213,3 +318,3 @@ task.fields(['Name', 'FID']).run(function(error, featureCollection, raw){ | ||
it('should limit geometry percision', function(done){ | ||
server.respondWith('GET', url + 'query?where=1%3D1&outSr=4326&outFields=*&geometryPrecision=4&f=json', JSON.stringify(sampleQueryResponse)); | ||
server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&geometryPrecision=4&f=json', JSON.stringify(sampleQueryResponse)); | ||
@@ -226,3 +331,3 @@ task.precision(4).run(function(error, featureCollection, raw){ | ||
it('should identify features and simplify geometries', function(done){ | ||
server.respondWith('GET', url + 'query?where=1%3D1&outSr=4326&outFields=*&maxAllowableOffset=0.000010728836059556101&f=json', JSON.stringify(sampleQueryResponse)); | ||
server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&maxAllowableOffset=0.000010728836059556101&f=json', JSON.stringify(sampleQueryResponse)); | ||
@@ -239,3 +344,3 @@ task.simplify(map, 0.5).run(function(error, featureCollection, raw){ | ||
it('should order query output ascending', function(done){ | ||
server.respondWith('GET', url + 'query?where=1%3D1&outSr=4326&outFields=*&orderByFields=Name%20ASC&f=json', JSON.stringify(sampleQueryResponse)); | ||
server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&orderByFields=Name%20ASC&f=json', JSON.stringify(sampleQueryResponse)); | ||
@@ -252,3 +357,3 @@ task.orderBy('Name').run(function(error, featureCollection, raw){ | ||
it('should order query output descending', function(done){ | ||
server.respondWith('GET', url + 'query?where=1%3D1&outSr=4326&outFields=*&orderByFields=Name%20DESC&f=json', JSON.stringify(sampleQueryResponse)); | ||
server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&orderByFields=Name%20DESC&f=json', JSON.stringify(sampleQueryResponse)); | ||
@@ -265,3 +370,3 @@ task.orderBy('Name', 'DESC').run(function(error, featureCollection, raw){ | ||
it('should order query output with multiple features', function(done){ | ||
server.respondWith('GET', url + 'query?where=1%3D1&outSr=4326&outFields=*&orderByFields=Name%20DESC%2CScore%20ASC&f=json', JSON.stringify(sampleQueryResponse)); | ||
server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&orderByFields=Name%20DESC%2CScore%20ASC&f=json', JSON.stringify(sampleQueryResponse)); | ||
@@ -278,3 +383,3 @@ task.orderBy('Name', 'DESC').orderBy('Score', 'ASC').run(function(error, featureCollection, raw){ | ||
it('should be able to query specific feature ids', function(done){ | ||
server.respondWith('GET', url + 'query?where=1%3D1&outSr=4326&outFields=*&objectIds=1%2C2&f=json', JSON.stringify(sampleQueryResponse)); | ||
server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&objectIds=1%2C2&f=json', JSON.stringify(sampleQueryResponse)); | ||
@@ -291,3 +396,3 @@ task.featureIds([1,2]).run(function(error, featureCollection, raw){ | ||
it('should be able to query token', function(done){ | ||
server.respondWith('GET', url + 'query?where=1%3D1&outSr=4326&outFields=*&token=foo&f=json', JSON.stringify(sampleQueryResponse)); | ||
server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&token=foo&f=json', JSON.stringify(sampleQueryResponse)); | ||
@@ -304,3 +409,3 @@ task.token('foo').run(function(error, featureCollection, raw){ | ||
it('should query bounds', function(done){ | ||
server.respondWith('GET', url + 'query?where=1%3D1&outSr=4326&outFields=*&returnExtentOnly=true&f=json', JSON.stringify(sampleExtentResponse)); | ||
server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&returnExtentOnly=true&f=json', JSON.stringify(sampleExtentResponse)); | ||
@@ -317,3 +422,3 @@ task.bounds(function(error, latlngbounds, raw){ | ||
it('should query count', function(done){ | ||
server.respondWith('GET', url + 'query?where=1%3D1&outSr=4326&outFields=*&returnCountOnly=true&f=json', JSON.stringify(sampleCountResponse)); | ||
server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&returnCountOnly=true&f=json', JSON.stringify(sampleCountResponse)); | ||
@@ -330,3 +435,3 @@ task.count(function(error, count, raw){ | ||
it('should query ids', function(done){ | ||
server.respondWith('GET', url + 'query?where=1%3D1&outSr=4326&outFields=*&returnIdsOnly=true&f=json', JSON.stringify(sampleIdsResponse)); | ||
server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&returnIdsOnly=true&f=json', JSON.stringify(sampleIdsResponse)); | ||
@@ -342,6 +447,6 @@ task.ids(function(error, ids, raw){ | ||
it('should use a service to query features', function(done){ | ||
server.respondWith('GET', url + 'query?where=1%3D1&outSr=4326&outFields=*&f=json', JSON.stringify(sampleQueryResponse)); | ||
it('should use a feature layer service to query features', function(done){ | ||
server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&f=json', JSON.stringify(sampleQueryResponse)); | ||
var service = new L.esri.Services.FeatureLayer(url); | ||
var service = new L.esri.Services.FeatureLayer(featureLayerUrl); | ||
@@ -357,2 +462,30 @@ service.query().run(function(error, featureCollection, raw){ | ||
it('should use a map service to query features', function(done){ | ||
server.respondWith('GET', mapServiceUrl + '0/query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&f=json', JSON.stringify(sampleMapServiceQueryResponse)); | ||
var service = new L.esri.Services.MapService(mapServiceUrl); | ||
service.query().layer(0).run(function(error, featureCollection, raw){ | ||
expect(featureCollection).to.deep.equal(sampleMapServiceCollection); | ||
expect(raw).to.deep.equal(sampleMapServiceQueryResponse); | ||
done(); | ||
}); | ||
server.respond(); | ||
}); | ||
it('should use a image service to query features', function(done){ | ||
server.respondWith('GET', imageServiceUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&pixelSize=1%2C1&f=json', JSON.stringify(sampleImageServiceQueryResponse)); | ||
var service = new L.esri.Services.MapService(imageServiceUrl); | ||
service.query().pixelSize([1, 1]).run(function(error, featureCollection, raw){ | ||
expect(featureCollection).to.deep.equal(sampleImageServiceCollection); | ||
expect(raw).to.deep.equal(sampleImageServiceQueryResponse); | ||
done(); | ||
}); | ||
server.respond(); | ||
}); | ||
}); |
L.esri = { | ||
VERSION: '0.0.1-beta.5', | ||
VERSION: '0.0.1-beta.6', | ||
Layers: {}, | ||
@@ -4,0 +4,0 @@ Services: {}, |
@@ -12,2 +12,4 @@ (function(L){ | ||
options: { | ||
hideLogo: false, | ||
logoPosition: 'bottomright', | ||
minZoom: 1, | ||
@@ -23,2 +25,4 @@ maxZoom: 19, | ||
options: { | ||
hideLogo: false, | ||
logoPosition: 'bottomright', | ||
minZoom: 1, | ||
@@ -34,2 +38,4 @@ maxZoom: 19, | ||
options: { | ||
hideLogo: false, | ||
logoPosition: 'bottomright', | ||
minZoom: 1, | ||
@@ -44,2 +50,4 @@ maxZoom: 16, | ||
options: { | ||
hideLogo: true, | ||
logoPosition: 'bottomright', | ||
//pane: 'esri-label', | ||
@@ -54,2 +62,4 @@ minZoom: 1, | ||
options: { | ||
hideLogo: false, | ||
logoPosition: 'bottomright', | ||
minZoom: 1, | ||
@@ -64,2 +74,4 @@ maxZoom: 16, | ||
options: { | ||
hideLogo: false, | ||
logoPosition: 'bottomright', | ||
minZoom: 1, | ||
@@ -74,2 +86,4 @@ maxZoom: 10, | ||
options: { | ||
hideLogo: true, | ||
logoPosition: 'bottomright', | ||
//pane: 'esri-label', | ||
@@ -84,2 +98,4 @@ minZoom: 1, | ||
options: { | ||
hideLogo: false, | ||
logoPosition: 'bottomright', | ||
minZoom: 1, | ||
@@ -94,2 +110,4 @@ maxZoom: 16, | ||
options: { | ||
hideLogo: true, | ||
logoPosition: 'bottomright', | ||
//pane: 'esri-label', | ||
@@ -104,2 +122,4 @@ minZoom: 1, | ||
options: { | ||
hideLogo: false, | ||
logoPosition: 'bottomright', | ||
minZoom: 1, | ||
@@ -114,2 +134,4 @@ maxZoom: 19, | ||
options: { | ||
hideLogo: true, | ||
logoPosition: 'bottomright', | ||
//pane: 'esri-label', | ||
@@ -125,2 +147,4 @@ minZoom: 1, | ||
options: { | ||
hideLogo: true, | ||
logoPosition: 'bottomright', | ||
minZoom: 1, | ||
@@ -134,2 +158,4 @@ maxZoom: 19, | ||
options: { | ||
hideLogo: false, | ||
logoPosition: 'bottomright', | ||
minZoom: 1, | ||
@@ -143,4 +169,6 @@ maxZoom: 13, | ||
urlTemplate: tileProtocol + '//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile/{z}/{y}/{x}', | ||
// pane: 'esri-label', | ||
options: { | ||
hideLogo: true, | ||
logoPosition: 'bottomright', | ||
//pane: 'esri-label', | ||
minZoom: 1, | ||
@@ -154,2 +182,4 @@ maxZoom: 12, | ||
options: { | ||
hideLogo: false, | ||
logoPosition: 'bottomright', | ||
minZoom: 1, | ||
@@ -164,2 +194,4 @@ maxZoom: 13, | ||
options: { | ||
hideLogo: true, | ||
logoPosition: 'bottomright', | ||
//pane: 'esri-label', | ||
@@ -197,2 +229,8 @@ minZoom: 1, | ||
onAdd: function(map){ | ||
if(!this.options.hideLogo){ | ||
this._logo = new L.esri.Controls.Logo({ | ||
position: this.options.logoPosition | ||
}).addTo(map); | ||
} | ||
// if(this.options.pane && L.esri.Support.pointerEvents){ | ||
@@ -207,2 +245,6 @@ // this._initPane(); | ||
onRemove: function(map){ | ||
if(this._logo){ | ||
map.removeControl(this._logo); | ||
} | ||
L.TileLayer.prototype.onRemove.call(this, map); | ||
@@ -213,4 +255,3 @@ | ||
getAttribution:function(){ | ||
var logo = '<a href="https://developers.arcgis.com" style="border: none;"><img src="http://js.arcgis.com/3.9/js/esri/images/map/logo-med.png" style="position:absolute; top:-38px; right:2px; border: none;"></a>'; | ||
var attribution = '<span class="esri-attributions" style="line-height:14px; vertical-align: -3px; text-overflow:ellipsis; white-space:nowrap; overflow:hidden; display:inline-block;">' + this.options.attribution + '</span>' + logo; | ||
var attribution = '<span class="esri-attributions" style="line-height:14px; vertical-align: -3px; text-overflow:ellipsis; white-space:nowrap; overflow:hidden; display:inline-block;">' + this.options.attribution + '</span>'/* + logo*/; | ||
return attribution; | ||
@@ -217,0 +258,0 @@ }, |
@@ -81,2 +81,6 @@ L.esri.Layers.ClusteredFeatureLayer = L.esri.Layers.FeatureManager.extend({ | ||
this.fire('createfeature', { | ||
feature: newLayer.feature | ||
}); | ||
// add the layer if it is within the time bounds or our layer is not time enabled | ||
@@ -98,2 +102,5 @@ if(!this.options.timeField || (this.options.timeField && this._featureWithinTimeRange(geojson)) ){ | ||
var layer = this._layers[ids[i]]; | ||
this.fire('addfeature', { | ||
feature: layer.feature | ||
}); | ||
layersToAdd.push(layer); | ||
@@ -104,7 +111,15 @@ } | ||
removeLayers: function(ids){ | ||
removeLayers: function(ids, permanent){ | ||
var layersToRemove = []; | ||
for (var i = ids.length - 1; i >= 0; i--) { | ||
var layer = this._layers[ids[i]]; | ||
var id = ids[i]; | ||
var layer = this._layers[id]; | ||
this.fire('removefeature', { | ||
feature: layer.feature, | ||
permanent: permanent | ||
}); | ||
layersToRemove.push(layer); | ||
if(this._layers[id] && permanent){ | ||
delete this._layers[id]; | ||
} | ||
} | ||
@@ -205,8 +220,8 @@ this.cluster.removeLayers(layersToRemove); | ||
L.esri.Layers.clusteredFeatureLayer = function(key, options){ | ||
return new L.esri.Layers.ClusteredFeatureLayer(key, options); | ||
L.esri.Layers.clusteredFeatureLayer = function(url, options){ | ||
return new L.esri.Layers.ClusteredFeatureLayer(url, options); | ||
}; | ||
L.esri.clusteredFeatureLayer = function(key, options){ | ||
return new L.esri.Layers.ClusteredFeatureLayer(key, options); | ||
}; | ||
L.esri.clusteredFeatureLayer = function(url, options){ | ||
return new L.esri.Layers.ClusteredFeatureLayer(url, options); | ||
}; |
/* globals L */ | ||
L.esri.Layers.DynamicMapLayer = L.esri.Layers.RasterLayer.extend({ | ||
L.esri.Layers.DynamicMapLayer = L.Class.extend({ | ||
includes: L.Mixin.Events, | ||
options: { | ||
opacity: 1, | ||
position: 'front', | ||
updateInterval: 150, | ||
@@ -15,4 +10,3 @@ layers: false, | ||
format: 'png24', | ||
transparent: true, | ||
f: 'image' | ||
transparent: true | ||
}, | ||
@@ -27,104 +21,2 @@ | ||
onAdd: function (map) { | ||
this._map = map; | ||
this._update = L.Util.limitExecByInterval(this._update, this.options.updateInterval, this); | ||
if (map.options.crs && map.options.crs.code) { | ||
var sr = map.options.crs.code.split(':')[1]; | ||
this.options.bboxSR = sr; | ||
this.options.imageSR = sr; | ||
} | ||
if(this._popup){ | ||
this._map.on('click', this._getPopupData, this); | ||
this._map.on('dblclick', this._resetPopupState, this); | ||
} | ||
// @TODO remove at Leaflet 0.8 | ||
this._map.addEventListener(this.getEvents(), this); | ||
this._update(); | ||
}, | ||
onRemove: function () { | ||
if (this._currentImage) { | ||
this._map.removeLayer(this._currentImage); | ||
} | ||
if(this._popup){ | ||
this._map.off('click', this._getPopupData, this); | ||
this._map.off('dblclick', this._resetPopupState, this); | ||
} | ||
// @TODO remove at Leaflet 0.8 | ||
this._map.removeEventListener(this.getEvents(), this); | ||
}, | ||
addTo: function(map){ | ||
map.addLayer(this); | ||
return this; | ||
}, | ||
removeFrom: function(map){ | ||
map.removeLayer(this); | ||
return this; | ||
}, | ||
getEvents: function(){ | ||
var events = { | ||
moveend: this._update | ||
}; | ||
return events; | ||
}, | ||
bringToFront: function(){ | ||
this.options.position = 'front'; | ||
if(this._currentImage){ | ||
this._currentImage.bringToFront(); | ||
} | ||
return this; | ||
}, | ||
bringToBack: function(){ | ||
this.options.position = 'back'; | ||
if(this._currentImage){ | ||
this._currentImage.bringToBack(); | ||
} | ||
return this; | ||
}, | ||
bindPopup: function(fn, popupOptions){ | ||
this._shouldRenderPopup = false; | ||
this._lastClick = false; | ||
this._popup = L.popup(popupOptions); | ||
this._popupFunction = fn; | ||
if(this._map){ | ||
this._map.on('click', this._getPopupData, this); | ||
this._map.on('dblclick', this._resetPopupState, this); | ||
} | ||
return this; | ||
}, | ||
unbindPopup: function(){ | ||
if(this._map){ | ||
this._map.closePopup(this._popup); | ||
this._map.off('click', this._getPopupData, this); | ||
this._map.off('dblclick', this._resetPopupState, this); | ||
} | ||
this._popup = false; | ||
return this; | ||
}, | ||
getOpacity: function(){ | ||
return this.options.opacity; | ||
}, | ||
setOpacity: function(opacity){ | ||
this.options.opacity = opacity; | ||
this._currentImage.setOpacity(opacity); | ||
return this; | ||
}, | ||
getLayers: function(){ | ||
@@ -160,18 +52,6 @@ return this.options.layers; | ||
getTimeRange: function(){ | ||
return [this.options.from, this.options.to]; | ||
query: function(){ | ||
return this._service.query(); | ||
}, | ||
setTimeRange: function(from, to){ | ||
this.options.from = from; | ||
this.options.to = to; | ||
this._update(); | ||
return this; | ||
}, | ||
metadata: function(callback, context){ | ||
this._service.metadata(callback, context); | ||
return this; | ||
}, | ||
identify: function(){ | ||
@@ -181,5 +61,4 @@ return this._service.identify(); | ||
authenticate: function(token){ | ||
this._service.authenticate(token); | ||
return this; | ||
find: function(){ | ||
return this._service.find(); | ||
}, | ||
@@ -207,17 +86,2 @@ | ||
_renderPopup: function(latlng, error, featureCollection, response){ | ||
if(this._shouldRenderPopup && this._lastClick.equals(latlng)){ | ||
//add the popup to the map where the mouse was clicked at | ||
var content = this._popupFunction(error, featureCollection, response); | ||
if (content) { | ||
this._popup.setLatLng(latlng).setContent(content).openOn(this._map); | ||
} | ||
} | ||
}, | ||
_resetPopupState: function(e){ | ||
this._shouldRenderPopup = false; | ||
this._lastClick = e.latlng; | ||
}, | ||
_buildExportParams: function () { | ||
@@ -262,61 +126,3 @@ var bounds = this._map.getBounds(); | ||
_renderImage: function(url, bounds){ | ||
var image = new L.ImageOverlay(url, bounds, { | ||
opacity: 0 | ||
}).addTo(this._map); | ||
image.once('load', function(e){ | ||
var newImage = e.target; | ||
var oldImage = this._currentImage; | ||
if(newImage._bounds.equals(bounds)){ | ||
this._currentImage = newImage; | ||
if(this.options.position === 'front'){ | ||
this.bringToFront(); | ||
} else { | ||
this.bringToBack(); | ||
} | ||
this._currentImage.setOpacity(this.options.opacity); | ||
if(oldImage){ | ||
this._map.removeLayer(oldImage); | ||
} | ||
} else { | ||
this._map.removeLayer(newImage); | ||
} | ||
this.fire('load', { | ||
bounds: bounds | ||
}); | ||
}, this); | ||
this.fire('loading', { | ||
bounds: bounds | ||
}); | ||
}, | ||
_update: function () { | ||
if(!this._map){ | ||
return; | ||
} | ||
var zoom = this._map.getZoom(); | ||
var bounds = this._map.getBounds(); | ||
if(this._animatingZoom){ | ||
return; | ||
} | ||
if (this._map._panTransition && this._map._panTransition._inProgress) { | ||
return; | ||
} | ||
if (zoom > this.options.maxZoom || zoom < this.options.minZoom) { | ||
return; | ||
} | ||
var params = this._buildExportParams(); | ||
_requestExport: function (params, bounds) { | ||
if(this.options.f === 'json'){ | ||
@@ -330,12 +136,2 @@ this._service.get('export', params, function(error, response){ | ||
} | ||
}, | ||
// from https://github.com/Leaflet/Leaflet/blob/v0.7.2/src/layer/FeatureGroup.js | ||
// @TODO remove at Leaflet 0.8 | ||
_propagateEvent: function (e) { | ||
e = L.extend({ | ||
layer: e.target, | ||
target: this | ||
}, e); | ||
this.fire(e.type, e); | ||
} | ||
@@ -346,8 +142,8 @@ }); | ||
L.esri.Layers.dynamicMapLayer = function(key, options){ | ||
return new L.esri.Layers.DynamicMapLayer(key, options); | ||
L.esri.Layers.dynamicMapLayer = function(url, options){ | ||
return new L.esri.Layers.DynamicMapLayer(url, options); | ||
}; | ||
L.esri.dynamicMapLayer = function(key, options){ | ||
return new L.esri.Layers.DynamicMapLayer(key, options); | ||
}; | ||
L.esri.dynamicMapLayer = function(url, options){ | ||
return new L.esri.Layers.DynamicMapLayer(url, options); | ||
}; |
@@ -93,2 +93,7 @@ L.esri.Layers.FeatureLayer = L.esri.Layers.FeatureManager.extend({ | ||
this.resetStyle(newLayer.feature.id); | ||
this.fire('createfeature', { | ||
feature: newLayer.feature | ||
}); | ||
// add the layer if it is within the time bounds or our layer is not time enabled | ||
@@ -102,28 +107,2 @@ if(!this.options.timeField || (this.options.timeField && this._featureWithinTimeRange(geojson)) ){ | ||
cellEnter: function(bounds, coords){ | ||
var key = this._cellCoordsToKey(coords); | ||
var layers = this._cache[key]; | ||
if(layers){ | ||
for (var i = layers.length - 1; i >= 0; i--) { | ||
var layer = this.getFeature(layers[i]); | ||
if(!this._map.hasLayer(layer)){ | ||
this._map.addLayer(layer); | ||
} | ||
} | ||
} | ||
}, | ||
cellLeave: function(bounds, coords){ | ||
var key = this._cellCoordsToKey(coords); | ||
var layers = this._cache[key]; | ||
if(layers){ | ||
for (var i = layers.length - 1; i >= 0; i--) { | ||
var layer = this.getFeature(layers[i]); | ||
if(this._map.hasLayer(layer)){ | ||
this._map.removeLayer(layer); | ||
} | ||
} | ||
} | ||
}, | ||
addLayers: function(ids){ | ||
@@ -133,2 +112,5 @@ for (var i = ids.length - 1; i >= 0; i--) { | ||
if(layer){ | ||
this.fire('addfeature', { | ||
feature: layer.feature | ||
}); | ||
this._map.addLayer(layer); | ||
@@ -139,8 +121,16 @@ } | ||
removeLayers: function(ids){ | ||
removeLayers: function(ids, permanent){ | ||
for (var i = ids.length - 1; i >= 0; i--) { | ||
var layer = this._layers[ids[i]]; | ||
var id = ids[i]; | ||
var layer = this._layers[id]; | ||
if(layer){ | ||
this.fire('removefeature', { | ||
feature: layer.feature, | ||
permanent: permanent | ||
}); | ||
this._map.removeLayer(layer); | ||
} | ||
if(layer && permanent){ | ||
delete this._layers[id]; | ||
} | ||
} | ||
@@ -230,8 +220,8 @@ }, | ||
L.esri.Layers.featureLayer = function(key, options){ | ||
return new L.esri.Layers.FeatureLayer(key, options); | ||
L.esri.Layers.featureLayer = function(url, options){ | ||
return new L.esri.Layers.FeatureLayer(url, options); | ||
}; | ||
L.esri.featureLayer = function(key, options){ | ||
return new L.esri.Layers.FeatureLayer(key, options); | ||
}; | ||
L.esri.featureLayer = function(url, options){ | ||
return new L.esri.Layers.FeatureLayer(url, options); | ||
}; |
@@ -48,3 +48,2 @@ (function(L){ | ||
this._cache = {}; | ||
this._currentSnapshot = []; // cache of what layers should be active | ||
@@ -66,2 +65,6 @@ this._activeRequests = 0; | ||
getAttribution: function () { | ||
return this.options.attribution; | ||
}, | ||
/** | ||
@@ -110,8 +113,5 @@ * Feature Managment | ||
_addFeatures: function(features, coords){ | ||
this._cache[coords] = this._cache[coords] || []; | ||
_addFeatures: function(features){ | ||
for (var i = features.length - 1; i >= 0; i--) { | ||
var id = features[i].id; | ||
this._cache[coords].push(id); | ||
this._currentSnapshot.push(id); | ||
@@ -331,4 +331,8 @@ } | ||
this._service.addFeature(feature, function(error, response){ | ||
this.refresh(); | ||
callback.call(context, error, response); | ||
if(!error){ | ||
this.refresh(); | ||
} | ||
if(callback){ | ||
callback.call(context, error, response); | ||
} | ||
}, this); | ||
@@ -340,4 +344,8 @@ return this; | ||
return this._service.updateFeature(feature, function(error, response){ | ||
this.refresh(); | ||
callback.call(context, error, response); | ||
if(!error){ | ||
this.refresh(); | ||
} | ||
if(callback){ | ||
callback.call(context, error, response); | ||
} | ||
}, this); | ||
@@ -348,4 +356,8 @@ }, | ||
return this._service.deleteFeature(id, function(error, response){ | ||
this.removeLayers([response.objectId]); | ||
callback.call(context, error, response); | ||
if(!error && response.objectId){ | ||
this.removeLayers([response.objectId], true); | ||
} | ||
if(callback){ | ||
callback.call(context, error, response); | ||
} | ||
}, this); | ||
@@ -352,0 +364,0 @@ } |
@@ -65,3 +65,3 @@ L.esri.Layers.HeatmapFeatureLayer = L.esri.Layers.FeatureManager.extend({ | ||
removeLayers: function(ids){ | ||
removeLayers: function(ids, permanent){ | ||
var newLatLngs = []; | ||
@@ -73,2 +73,5 @@ for (var i = ids.length - 1; i >= 0; i--) { | ||
} | ||
if(this._cache[id] && permanent){ | ||
delete this._cache[id]; | ||
} | ||
} | ||
@@ -87,8 +90,8 @@ | ||
L.esri.Layers.heatmapFeatureLayer = function(key, options){ | ||
return new L.esri.Layers.HeatmapFeatureLayer(key, options); | ||
L.esri.Layers.heatmapFeatureLayer = function(url, options){ | ||
return new L.esri.Layers.HeatmapFeatureLayer(url, options); | ||
}; | ||
L.esri.heatmapFeatureLayer = function(key, options){ | ||
return new L.esri.Layers.heatmapFeatureLayer(key, options); | ||
}; | ||
L.esri.heatmapFeatureLayer = function(url, options){ | ||
return new L.esri.Layers.heatmapFeatureLayer(url, options); | ||
}; |
@@ -52,2 +52,3 @@ (function(L){ | ||
response = JSON.parse(httpRequest.responseText); | ||
} catch(e) { | ||
@@ -54,0 +55,0 @@ response = null; |
@@ -19,3 +19,6 @@ L.esri.Services.FeatureLayer = L.esri.Services.Service.extend({ | ||
}, function(error, response){ | ||
callback.call(this, error || response.addResults[0].error, response.addResults[0]); | ||
var result = (response && response.addResults) ? response.addResults[0] : undefined; | ||
if(callback){ | ||
callback.call(this, error || response.addResults[0].error, result); | ||
} | ||
}, context); | ||
@@ -29,3 +32,6 @@ }, | ||
}, function(error, response){ | ||
callback.call(context, error || response.updateResults[0].error, response.updateResults[0]); | ||
var result = (response && response.updateResults) ? response.updateResults[0] : undefined; | ||
if(callback){ | ||
callback.call(context, error || response.updateResults[0].error, result); | ||
} | ||
}, context); | ||
@@ -38,3 +44,6 @@ }, | ||
}, function(error, response){ | ||
callback.call(context, error || response.deleteResults[0].error, response.deleteResults[0]); | ||
var result = (response && response.deleteResults) ? response.deleteResults[0] : undefined; | ||
if(callback){ | ||
callback.call(context, error || response.deleteResults[0].error, result); | ||
} | ||
}, context); | ||
@@ -41,0 +50,0 @@ } |
L.esri.Services.MapService = L.esri.Services.Service.extend({ | ||
identify: function () { | ||
return new L.esri.Tasks.Identify(this); | ||
return new L.esri.Tasks.identifyFeatures(this); | ||
}, | ||
find: function () { | ||
return new L.esri.Tasks.Find(this); | ||
}, | ||
query: function () { | ||
return new L.esri.Tasks.Query(this); | ||
} | ||
@@ -6,0 +14,0 @@ |
@@ -14,3 +14,3 @@ L.esri.Services.Service = L.Class.extend({ | ||
this._authenticating = false; | ||
options = L.Util.setOptions(this, options); | ||
L.Util.setOptions(this, options); | ||
}, | ||
@@ -17,0 +17,0 @@ |
L.esri.Tasks.Identify = L.Class.extend({ | ||
initialize: function(endpoint){ | ||
if(endpoint.url && endpoint.get){ | ||
this._service = endpoint; | ||
this.url = endpoint.url; | ||
} else { | ||
this.url = L.esri.Util.cleanUrl(endpoint); | ||
} | ||
this._params = { | ||
sr: 4326, | ||
layers: 'all', | ||
tolerance: 3 | ||
}; | ||
}, | ||
on: function(map){ | ||
var extent = L.esri.Util.boundsToExtent(map.getBounds()); | ||
var size = map.getSize(); | ||
this._params.imageDisplay = [size.x, size.y, 96].join(','); | ||
this._params.mapExtent=([extent.xmin, extent.ymin, extent.xmax, extent.ymax]).join(','); | ||
return this; | ||
}, | ||
at: function(latlng){ | ||
this._params.geometry = ([latlng.lng, latlng.lat]).join(','); | ||
this._params.geometryType = 'esriGeometryPoint'; | ||
return this; | ||
}, | ||
layerDef: function (id, where){ | ||
this._params.layerDefs = (this._params.layerDefs) ? this._params.layerDefs + ';' : ''; | ||
this._params.layerDefs += ([id, where]).join(':'); | ||
return this; | ||
}, | ||
between: function(start, end){ | ||
@@ -43,18 +8,7 @@ this._params.time = ([start.valueOf(), end.valueOf()]).join(','); | ||
layers: function (string){ | ||
this._params.layers = string; | ||
returnGeometry: function (returnGeometry) { | ||
this._params.returnGeometry = returnGeometry; | ||
return this; | ||
}, | ||
precision: function(num){ | ||
this._params.geometryPrecision = num; | ||
return this; | ||
}, | ||
simplify: function(map, factor){ | ||
var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast()); | ||
this._params.maxAllowableOffset = (mapWidth / map.getSize().y) * (1 - factor); | ||
return this; | ||
}, | ||
token: function(token){ | ||
@@ -65,13 +19,2 @@ this._params.token = token; | ||
tolerance: function(tolerance){ | ||
this._params.tolerance = tolerance; | ||
return this; | ||
}, | ||
run: function (callback, context){ | ||
this._request(function(error, response){ | ||
callback.call(context, error, (response && L.esri.Util.responseToFeatureCollection(response)), response); | ||
}, context); | ||
}, | ||
_request: function(callback, context){ | ||
@@ -86,5 +29,1 @@ if(this._service){ | ||
}); | ||
L.esri.Tasks.identify = function(url, params){ | ||
return new L.esri.Tasks.Identify(url, params); | ||
}; |
@@ -12,3 +12,7 @@ L.esri.Tasks.Query = L.Class.extend({ | ||
this._originalUrl = this.url; | ||
this._urlPrefix = ''; | ||
this._params = { | ||
returnGeometry: true, | ||
where: '1=1', | ||
@@ -24,5 +28,7 @@ outSr: 4326, | ||
this._params.spatialRel = 'esriSpatialRelIntersects'; | ||
this._params.inSr = 4326; | ||
return this; | ||
}, | ||
// only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online | ||
nearby: function(latlng, radius){ | ||
@@ -58,4 +64,8 @@ this._params.geometry = ([latlng.lng,latlng.lat]).join(','); | ||
fields: function(array){ | ||
this._params.outFields = array.join(','); | ||
fields: function (fields) { | ||
if (L.Util.isArray(fields)) { | ||
this._params.outFields = fields.join(','); | ||
} else { | ||
this._params.outFields = fields; | ||
} | ||
return this; | ||
@@ -69,2 +79,7 @@ }, | ||
returnGeometry: function (returnGeometry) { | ||
this._params.returnGeometry = returnGeometry; | ||
return this; | ||
}, | ||
simplify: function(map, factor){ | ||
@@ -119,2 +134,3 @@ var mapWidth = Math.abs(map.getBounds().getWest() - map.getBounds().getEast()); | ||
// only valid for Feature Services running on ArcGIS Server 10.3 or ArcGIS Online | ||
bounds: function(callback, context){ | ||
@@ -129,2 +145,15 @@ this._cleanParams(); | ||
// only valid for image services | ||
pixelSize: function(point){ | ||
point = L.point(point); | ||
this._params.pixelSize = ([point.x,point.y]).join(','); | ||
return this; | ||
}, | ||
// only valid for map services | ||
layer: function(layer){ | ||
this._urlPrefix = layer + '/'; | ||
return this; | ||
}, | ||
_cleanParams: function(){ | ||
@@ -138,5 +167,5 @@ delete this._params.returnIdsOnly; | ||
if(this._service){ | ||
this._service.get('query', this._params, callback, context); | ||
this._service.get(this._urlPrefix +'query', this._params, callback, context); | ||
} else { | ||
L.esri.get(this.url + 'query', this._params, callback, context); | ||
L.esri.get(this.url + this._urlPrefix + 'query', this._params, callback, context); | ||
} | ||
@@ -143,0 +172,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
160
149
1933949
27
7825