From 410b014c55f924112c0d8b09df6b819d1bcf14cd Mon Sep 17 00:00:00 2001 From: jgravois Date: Tue, 18 Oct 2016 16:03:45 -0700 Subject: [PATCH 1/3] new MultiPolygon test --- spec/Tasks/QuerySpec.js | 20 ++++++++++++++++++++ src/Tasks/Query.js | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/spec/Tasks/QuerySpec.js b/spec/Tasks/QuerySpec.js index a5bfae0d9..011a1bdd1 100644 --- a/spec/Tasks/QuerySpec.js +++ b/spec/Tasks/QuerySpec.js @@ -29,6 +29,14 @@ describe('L.esri.Query', function () { ]] }; + var rawGeoJsonMultiPolygon = { + 'type': 'MultiPolygon', + 'coordinates': [ + [[[-97, 39], [-97, 41], [-94, 41], [-94, 39], [-97, 39]]], + [[[-96, 39.5], [-96, 40.5], [-95, 40.5], [-95, 39.5], [-96, 39.5]]] + ] + }; + var rawGeoJsonFeature = {'type': 'Feature'}; rawGeoJsonFeature.geometry = rawGeoJsonPolygon; @@ -257,6 +265,18 @@ describe('L.esri.Query', function () { server.respond(); }); + it('should query features within a geojson multipolygon geometry', function (done) { + server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&inSr=4326&geometry=%7B%22rings%22%3A%5B%5B%5B-97%2C39%5D%2C%5B-97%2C41%5D%2C%5B-94%2C41%5D%2C%5B-94%2C39%5D%2C%5B-97%2C39%5D%5D%2C%5B%5B-96%2C39.5%5D%2C%5B-96%2C40.5%5D%2C%5B-95%2C40.5%5D%2C%5B-95%2C39.5%5D%2C%5B-96%2C39.5%5D%5D%5D%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryPolygon&spatialRel=esriSpatialRelContains&f=json', JSON.stringify(sampleQueryResponse)); + + task.within(rawGeoJsonMultiPolygon).run(function (error, featureCollection, raw) { + expect(featureCollection).to.deep.equal(sampleFeatureCollection); + expect(raw).to.deep.equal(sampleQueryResponse); + done(); + }); + + server.respond(); + }); + it('should query features within geojson feature', function (done) { server.respondWith('GET', featureLayerUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&inSr=4326&geometry=%7B%22rings%22%3A%5B%5B%5B-97%2C39%5D%2C%5B-97%2C41%5D%2C%5B-94%2C41%5D%2C%5B-94%2C39%5D%2C%5B-97%2C39%5D%5D%5D%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D&geometryType=esriGeometryPolygon&spatialRel=esriSpatialRelContains&f=json', JSON.stringify(sampleQueryResponse)); diff --git a/src/Tasks/Query.js b/src/Tasks/Query.js index 756ef1e0d..17b14d117 100644 --- a/src/Tasks/Query.js +++ b/src/Tasks/Query.js @@ -218,7 +218,7 @@ export var Query = Task.extend({ } // warn the user if we havn't found an appropriate object - Util.warn('invalid geometry passed to spatial query. Should be an L.LatLng, L.LatLngBounds or L.Marker or a GeoJSON Point Line or Polygon object'); + Util.warn('invalid geometry passed to spatial query. Should be L.LatLng, L.LatLngBounds, L.Marker or a GeoJSON Point, Line, Polygon or MultiPolygon object'); return; } From 3083da2d5add39c84a6b45da45c81bf108004748 Mon Sep 17 00:00:00 2001 From: jgravois Date: Tue, 18 Oct 2016 16:14:52 -0700 Subject: [PATCH 2/3] :package: 2.0.4 --- CHANGELOG.md | 18 +++++++++++++++++- README.md | 6 +++--- package.json | 2 +- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 854b61772..3ea122c17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,21 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Upcoming changes][unreleased] +## [2.0.4] + +### Changed +* The default maximum width of Leaflet's attribution control is now `55px. +less than the map itself + +### Added +* A custom width crop can be configured via `L.esri.options.attributionWidthOffset` +* `L.esri.query` now supports GeoJSON MultiPolygons + +### Fixed +* test suite code is now linted +* `responseToFeatureCollection` now uses a case insensitive regex to look for common indexing field names +* `GeoJSON` / `geoJSON` casing is now used consistently + ## [2.0.3] ### Added @@ -459,7 +474,8 @@ None * Add DarkGray and DarkGrayLabels to BasemapLayer. #190 * An attributionControl on maps is now required when using BasemapLayer. #159 -[unreleased]: https://github.com/esri/esri-leaflet/compare/v2.0.3...HEAD +[unreleased]: https://github.com/esri/esri-leaflet/compare/v2.0.4...HEAD +[2.0.4]: https://github.com/esri/esri-leaflet/compare/v2.0.3...v2.0.4 [2.0.3]: https://github.com/esri/esri-leaflet/compare/v2.0.2...v2.0.3 [2.0.2]: https://github.com/esri/esri-leaflet/compare/v2.0.1...v2.0.2 [2.0.1]: https://github.com/esri/esri-leaflet/compare/v2.0.0...v2.0.1 diff --git a/README.md b/README.md index a568c6c8c..ebfdd4ca9 100644 --- a/README.md +++ b/README.md @@ -54,11 +54,11 @@ The easiest way to get started is to load Esri Leaflet via [CDN](https://unpkg.c - - + + - +