-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewrite as an ES6 esri leaflet plugin
add attribution wip: external attribution invoke parent method too inherit from L.layer instead coming along no more jsnext:main even better not sure what happened there ahhh we DO need a rollup flag to build main rearrange, add debug, update README a few more terms
- Loading branch information
Showing
12 changed files
with
324 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,110 @@ | ||
# Esri Leaflet Vector Basemap Proof-of-Concept | ||
# Esri Leaflet Vector Tile Plugin | ||
|
||
This is a proof of concept for using the [ArcGIS Online Vector Basemaps](http://www.arcgis.com/home/group.html?id=30de8da907d240a0bccd5ad3ff25ef4a&focus=layers) with [Esri Leaflet](https://github.com/Esri/esri-leaflet). It uses https://github.com/patrickarlt/mapbox-gl-leaflet/tree/leaflet-master which is a fork of https://github.com/mapbox/mapbox-gl-leaflet updated for Leaflet 1.0.0 and a custom fork of [mapbox-gl-js](https://github.com/patrickarlt/mapbox-gl-js/tree/esri-leaflet-renderer) which is based off of https://github.com/Esri/mapbox-gl-js/tree/indexed-vector-sources and https://github.com/Esri/vector-tile-js/tree/clipping-logic. | ||
[![npm version][npm-img]][npm-url] | ||
[![apache licensed](https://img.shields.io/badge/license-Apache-green.svg?style=flat-square)](https://raw.githubusercontent.com/Esri/esri-leaflet-vector/master/LICENSE) | ||
|
||
## Caveats | ||
[npm-img]: https://img.shields.io/npm/v/esri-leaflet-vector.svg?style=flat-square | ||
[npm-url]: https://www.npmjs.com/package/esri-leaflet-vector | ||
|
||
* Mostly untested. Works against the basemap styles listed at https://developers.arcgis.com/javascript/beta/api-reference/esri-layers-VectorTileLayer.html#url | ||
* No proper handling of attribution | ||
> A plugin for Esri Leaflet to visualize Vector tiles from ArcGIS Online. Built on top of [`mapbox-gl-leaflet`](https://github.com/mapbox/mapbox-gl-leaflet). | ||
## Instructions | ||
## Example | ||
|
||
1. Fork and then clone the repo. | ||
2. Open `index.html` | ||
Take a look at the [live demo](http://esri.github.com/esri-leaflet/examples/vector-basemap.html). | ||
|
||
![Example Image](example.png) | ||
|
||
```html | ||
<html> | ||
<head> | ||
<meta charset=utf-8 /> | ||
<title>Esri Vector Basemap</title> | ||
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' /> | ||
|
||
<!-- Load libraries from CDN --> | ||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.0-rc.3/dist/leaflet.css" /> | ||
<script src="https://unpkg.com/leaflet@1.0.0-rc.3"></script> | ||
|
||
<!-- Esri Leaflet and Esri Leaflet Vector --> | ||
<script src="https://unpkg.com/esri-leaflet@2.0.2"></script> | ||
<script src="https://unpkg.com/esri-leaflet-vector@1.0.0"></script> | ||
|
||
<style> | ||
body {margin:0;padding:0;} | ||
#map {position: absolute;top:0;bottom:0;right:0;left:0;} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<div id="map"></div> | ||
|
||
<script> | ||
var map = L.map('map').setView([ 40.706, -73.926], 14); | ||
L.esri.Vector.basemap('Topographic').addTo(map); | ||
</script> | ||
|
||
</body> | ||
</html> | ||
``` | ||
|
||
## API Reference | ||
|
||
### [`L.esri.Vector.basemap`](http://esri.github.io/esri-leaflet/api-reference/layers/vector-basemap.html) | ||
|
||
### Development Instructions | ||
|
||
1. [Fork and clone this repo](https://help.github.com/articles/fork-a-repo) | ||
2. `cd` into the `esri-leaflet-vector` folder | ||
3. Install the dependencies with `npm install` | ||
4. run `npm run build` to compile the raw source inside a newly created `dist` folder. | ||
5. run `npm test` from the command line to execute tests | ||
6. Open `debug/sample.html` to see local changes in action. | ||
6. Create a [pull request](https://help.github.com/articles/creating-a-pull-request) if you'd like to share your work. | ||
|
||
## Dependencies | ||
|
||
* Leaflet version [1.0.0-rc.3](https://github.com/Leaflet/Leaflet/releases/tag/v1.0.0-rc.3) (or higher) is required. | ||
* Esri Leaflet [2.0.3](https://github.com/Esri/esri-leaflet/releases/tag/v2.0.3) (or higher) is required. | ||
* [Mapbox GL Leaflet](https://github.com/patrickarlt/mapbox-gl-leaflet.git#leaflet-master) | ||
* [a fork of Mapbox GL JS](https://github.com/jgravois/mapbox-gl-js.git#esri-leaflet-renderer) | ||
|
||
## Resources | ||
|
||
* [mapbox-gl-js fork](https://github.com/patrickarlt/mapbox-gl-leaflet/tree/leaflet-master) | ||
* [mapbox-gl-leaflet fork](https://github.com/patrickarlt/mapbox-gl-js/tree/esri-leaflet-renderer) | ||
* [ArcGIS for Developers](http://developers.arcgis.com) | ||
* [ArcGIS REST Services](http://resources.arcgis.com/en/help/arcgis-rest-api/) | ||
* [@Esri](http://twitter.com/esri) | ||
* [@EsriPDX](http://twitter.com/esripdx) | ||
|
||
## Issues | ||
|
||
Find a bug or want to request a new feature? Please let us know by submitting an issue. | ||
Find a bug or want to request a new feature? Please let us know by submitting an [issue](https://github.com/Esri/esri-leaflet-heatmap-feature-layer/issues). | ||
|
||
Please take a look at previous issues on [Esri Leaflet](https://github.com/Esri/esri-leaflet/issues?labels=FAQ&milestone=&page=1&state=closed) and Esri Leaflet [Vector](https://github.com/Esri/esri-leaflet-vector/issues) that resolve common problems. | ||
|
||
You can also post issues on the [GIS Stackexchange](http://gis.stackexchange.com/questions/ask?tags=esri-leaflet,leaflet) an/or the [Esri Leaflet place](https://geonet.esri.com/discussion/create.jspa?sr=pmenu&containerID=1841&containerType=700&tags=esri-leaflet,leaflet) on GeoNet. | ||
|
||
## Contributing | ||
|
||
Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](https://github.com/esri/contributing). | ||
Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](https://github.com/Esri/esri-leaflet/blob/master/CONTRIBUTING.md). | ||
|
||
## [Terms](https://github.com/Esri/esri-leaflet#terms) | ||
|
||
## Licensing | ||
Copyright 2015 Esri | ||
Copyright 2016 Esri | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
> http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
|
||
A copy of the license is available in the repository's [license.txt]( https://raw.github.com/Esri/quickstart-map-js/master/license.txt) file. | ||
A copy of the license is available in the repository's [LICENSE](./LICENSE) file. | ||
|
||
[](Esri Tags: Leaflet) | ||
[](Esri Language: JavaScript) | ||
[](Esri Tags: ArcGIS Web Mapping Leaflet Vector VectorTiles Tiles) | ||
[](Esri Language: JavaScript) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<html> | ||
<head> | ||
<title>Esri Vector Basemaps</title> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
<!-- Leaflet --> | ||
<script src="https://cdn.jsdelivr.net/leaflet/1.0.0-rc.3/leaflet.js"></script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/leaflet/1.0.0-rc.3/leaflet.css"> | ||
|
||
<!-- Esri Leaflet --> | ||
<script src="../node_modules/esri-leaflet/dist/esri-leaflet-debug.js"></script> | ||
|
||
<script src="../dist/esri-leaflet-vector-debug.js"></script> | ||
|
||
<style> | ||
html, body { | ||
margin: 0; | ||
} | ||
|
||
#map { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div id="map"></div> | ||
<script> | ||
var map = L.map('map').setView([45.526, -122.667], 13); | ||
var basemap = L.esri.Vector.basemap('Topographic').addTo(map); | ||
</script> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,51 @@ | ||
{ | ||
"name": "esri-leaflet-vector-basemap-poc", | ||
"name": "esri-leaflet-vector", | ||
"description": "Esri vector basemap plugin for Leaflet.", | ||
"version": "1.0.0", | ||
"description": "This is a proof of concept for using the [ArcGIS Online Vector Basemaps](http://www.arcgis.com/home/group.html?id=30de8da907d240a0bccd5ad3ff25ef4a&focus=layers) with [Esri Leaflet](https://github.com/Esri/esri-leaflet). It uses https://github.com/patrickarlt/mapbox-gl-leaflet/tree/leaflet-master which is a fork of https://github.com/mapbox/mapbox-gl-leaflet updated for Leaflet 1.0.0 and a custom fork of [mapbox-gl-js](https://github.com/patrickarlt/mapbox-gl-js/tree/esri-leaflet-renderer) which is based off of https://github.com/Esri/mapbox-gl-js/tree/indexed-vector-sources and https://github.com/Esri/vector-tile-js/tree/clipping-logic.", | ||
"main": "leaflet-mapbox-gl.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ArcGIS/esri-leaflet-vector-basemap-poc.git" | ||
}, | ||
"author": "", | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/ArcGIS/esri-leaflet-vector-basemap-poc/issues" | ||
"url": "https://github.com/ArcGIS/esri-leaflet-vector/issues" | ||
}, | ||
"homepage": "https://github.com/ArcGIS/esri-leaflet-vector-basemap-poc#readme", | ||
"dependencies": { | ||
"mapbox-gl": "git+https://github.com/patrickarlt/mapbox-gl-js.git#esri-leaflet-renderer", | ||
"esri-leaflet": "^2.0.2", | ||
"leaflet": "^1.0.0-rc.3", | ||
"mapbox-gl": "git+https://github.com/jgravois/mapbox-gl-js.git#esri-leaflet-renderer", | ||
"mapbox-gl-leaflet": "git+https://github.com/patrickarlt/mapbox-gl-leaflet.git#leaflet-master" | ||
}, | ||
"devDependencies": { | ||
"gh-release": "^2.0.0", | ||
"http-server": "^0.8.5", | ||
"mkdirp": "^0.5.1", | ||
"nodemon": "^1.9.2", | ||
"rollup": "^0.25.4", | ||
"rollup-plugin-json": "^2.0.0", | ||
"rollup-plugin-node-resolve": "^1.4.0", | ||
"rollup-plugin-uglify": "^0.3.1", | ||
"semistandard": "^7.0.5", | ||
"snazzy": "^2.0.1" | ||
}, | ||
"homepage": "https://github.com/ArcGIS/esri-leaflet-vector#readme", | ||
"jsnext:main": "src/EsriLeafletVector.js", | ||
"jspm": { | ||
"registry": "npm", | ||
"format": "es6", | ||
"main": "src/EsriLeafletVector.js" | ||
}, | ||
"license": "Apache-2.0", | ||
"main": "dist/esri-leaflet-vector-debug.js", | ||
"browser": "dist/esri-leaflet-vector-debug.js", | ||
"readmeFilename": "README.md", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ArcGIS/esri-leaflet-vector-basemap.git" | ||
}, | ||
"scripts": { | ||
"prebuild": "mkdirp dist", | ||
"build": "rollup -c profiles/debug.js & rollup -c profiles/production.js", | ||
"lint": "semistandard src/**/*.js | snazzy", | ||
"prepublish": "npm run build", | ||
"pretest": "npm run build", | ||
"start": "nodemon --watch src --exec 'npm run build' & http-server -p 8765 -c-1 -o", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import config from '../node_modules/esri-leaflet/profiles/base.js'; | ||
import nodeResolve from 'rollup-plugin-node-resolve'; | ||
|
||
config.entry = 'src/EsriLeafletVector.js'; | ||
config.moduleName = 'L.esri.Vector'; | ||
|
||
// to do: try and wrap ol' mapbox-gl w/o a jsnext:main field | ||
config.plugins[0] = nodeResolve({ | ||
jsnext: true, | ||
main: true, | ||
browser: false, | ||
extensions: [ '.js', '.json' ] | ||
}) | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import config from './base.js'; | ||
|
||
config.dest = 'dist/esri-leaflet-vector-debug.js'; | ||
config.sourceMap = 'inline'; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import uglify from 'rollup-plugin-uglify'; | ||
import config from './base.js' | ||
|
||
config.dest = 'dist/esri-leaflet-vector.js'; | ||
config.sourceMap = 'dist/esri-leaflet-vector.js.map'; | ||
|
||
// use a Regex to preserve copyright text | ||
config.plugins.push(uglify({ output: { comments: /Institute, Inc/ } })); | ||
|
||
export default config; |
Oops, something went wrong.