Skip to content

Commit 0ffa1cc

Browse files
committed
Minor improvement to bounds handling. Publish next version.
1 parent fdef85f commit 0ffa1cc

File tree

5 files changed

+29
-13
lines changed

5 files changed

+29
-13
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.0.7
2+
- Make the `useSeviceBounds` option non-blocking so that data draws quicker and only the bounds check only gets applied to subsequent requests
3+
- Update build process and packaging
4+
15
## 0.0.6
26
- Fix conditional on fetchOptions
37

docs/src/Map.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import { Map, Popup } from 'maplibre-gl'
77
import 'maplibre-gl/dist/maplibre-gl.css'
88
import FeatureService from '../../src/main'
9+
// import FeatureService from '../../dist/mapbox-gl-arcgis-featureserver.js'
910
1011
let layer = null
1112
let map = null

package.json

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mapbox-gl-arcgis-featureserver",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"description": "A small library for requesting features from an arcgis feature server using tiles",
55
"main": "dist/mapbox-gl-arcgis-featureserver.js",
66
"module": "dist/mapbox-gl-arcgis-featureserver.esm.js",
@@ -15,7 +15,7 @@
1515
"build-docs": "cross-env NODE_ENV=production webpack --config docs/webpack.config.js --mode production --progress --hide-modules",
1616
"dev": "cross-env webpack-dev-server --config docs/webpack.config.js --mode development --open --hot"
1717
},
18-
"author": "",
18+
"author": "Rowan Winsemius",
1919
"license": "Apache-2.0",
2020
"dependencies": {
2121
"@mapbox/tilebelt": "^1.0.2",
@@ -48,5 +48,18 @@
4848
"webpack": "^4.29.0",
4949
"webpack-cli": "^3.2.1",
5050
"webpack-dev-server": "^3.1.14"
51-
}
51+
},
52+
"repository": "github:rowanwins/mapbox-gl-arcgis-featureserver",
53+
"bugs": {
54+
"url": "https://github.com/rowanwins/mapbox-gl-arcgis-featureserver/issues"
55+
},
56+
"keywords": [
57+
"mapbox-gl-js",
58+
"mapbox-gl",
59+
"maplibre-gl-js",
60+
"maplibre-gl",
61+
"esri",
62+
"arcgis",
63+
"featureserver"
64+
]
5265
}

rollup.config.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,19 @@ const output = (input, file, format, plugins) => ({
99
file,
1010
format
1111
},
12-
external: ['pbf'],
1312
plugins
1413
})
1514

1615
export default [
1716
output('./src/main.js', './dist/mapbox-gl-arcgis-featureserver.js', 'umd', [
18-
commonjs(),
19-
resolve()
17+
commonjs()
2018
]),
2119
output('./src/main.js', './dist/mapbox-gl-arcgis-featureserver.min.js', 'umd', [
22-
commonjs(),
2320
resolve(),
21+
commonjs(),
2422
terser()
2523
]),
2624
output('./src/main.js', './dist/mapbox-gl-arcgis-featureserver.esm.js', 'esm', [
27-
commonjs(),
28-
resolve()
25+
commonjs()
2926
])
3027
]

src/main.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ export default class FeatureService {
5454
const serviceExtent = this.serviceMetadata.extent
5555
if (serviceExtent.spatialReference.wkid === 4326) {
5656
this._setBounds([serviceExtent.xmin, serviceExtent.ymin, serviceExtent.xmax, serviceExtent.ymax])
57-
this._clearAndRefreshTiles()
5857
} else {
5958
this._projectBounds()
6059
}
@@ -66,6 +65,7 @@ export default class FeatureService {
6665

6766
this._setAttribution()
6867
this.enableRequests()
68+
this._clearAndRefreshTiles()
6969
})
7070
}
7171

@@ -163,8 +163,10 @@ export default class FeatureService {
163163
const bounds = this._map.getBounds().toArray()
164164
const primaryTile = tilebelt.bboxToTile([bounds[0][0], bounds[0][1], bounds[1][0], bounds[1][1]])
165165

166-
if (this._esriServiceOptions.useSeviceBounds && !this._doesTileOverlapBbox(this._maxExtent, bounds)) {
167-
return
166+
if (this._esriServiceOptions.useSeviceBounds) {
167+
if (this._maxExtent[0] !== -Infinity && !this._doesTileOverlapBbox(this._maxExtent, bounds)) {
168+
return
169+
}
168170
}
169171

170172
// If we're not using a static zoom level we'll round to the nearest even zoom level
@@ -399,7 +401,6 @@ export default class FeatureService {
399401
.then((data) => {
400402
const extent = data.geometries[0]
401403
this._maxExtent = [extent.xmin, extent.ymin, extent.xmax, extent.ymax]
402-
this._clearAndRefreshTiles()
403404
})
404405
.catch((error) => {
405406
// if projection endpoint has already been set to fallback, do not re-request project bounds

0 commit comments

Comments
 (0)