Compare commits
496 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
73d4c3565c | ||
|
|
cc30f5f3da | ||
|
|
4e11a86b4e | ||
|
|
9f21f1dac4 | ||
|
|
d0f71bf64f | ||
|
|
950bb1810c | ||
|
|
81d0e9ea63 | ||
|
|
4b55175b7e | ||
|
|
cdf9eda132 | ||
|
|
7a953a166e | ||
|
|
f2d5d572ab | ||
|
|
02904cda8e | ||
|
|
24b7b27836 | ||
|
|
9da8cd890e | ||
|
|
eaab8e47ce | ||
|
|
b440872e60 | ||
|
|
247eb62e3b | ||
|
|
960c51f95d | ||
|
|
8e489304c1 | ||
|
|
2df40f4b88 | ||
|
|
c2d4bf113d | ||
|
|
806588edc6 | ||
|
|
ad6c731823 | ||
|
|
17749dbf96 | ||
|
|
a8c6baa188 | ||
|
|
ef63908539 | ||
|
|
d642fe6783 | ||
|
|
268d6eda8f | ||
|
|
84288cd8bb | ||
|
|
996e119b25 | ||
|
|
f54a8ea432 | ||
|
|
5b21d61688 | ||
|
|
1f04495dc3 | ||
|
|
8373814243 | ||
|
|
d7c0aa4887 | ||
|
|
e6c2fa52f5 | ||
|
|
17b667d6e0 | ||
|
|
81750ea6b1 | ||
|
|
12b8624cdb | ||
|
|
a546e09b96 | ||
|
|
1e8bbb0ae4 | ||
|
|
6c7d6817bd | ||
|
|
8e72eb8652 | ||
|
|
308e37a48e | ||
|
|
82f6fb9e6d | ||
|
|
1d21f76ad3 | ||
|
|
59574da74c | ||
|
|
ccf47de448 | ||
|
|
84b418b5c6 | ||
|
|
7b8feaa48f | ||
|
|
612280c676 | ||
|
|
35579ab714 | ||
|
|
83e251621a | ||
|
|
6e7b130a45 | ||
|
|
69aa277848 | ||
|
|
a9675576d3 | ||
|
|
38e43e018c | ||
|
|
7cc43d36ef | ||
|
|
9cb86df61c | ||
|
|
00fbb77c19 | ||
|
|
2d2ebe0e12 | ||
|
|
92da3629d7 | ||
|
|
7822f5ce5d | ||
|
|
f77480ec28 | ||
|
|
2d6ce527e2 | ||
|
|
9baa296a49 | ||
|
|
f36c02b0b8 | ||
|
|
5bc00d8535 | ||
|
|
9f0fefd42d | ||
|
|
068960e4b2 | ||
|
|
6276bbce38 | ||
|
|
5e4e9100e4 | ||
|
|
c836f97ec3 | ||
|
|
e8ed9c7e49 | ||
|
|
bcf379cc8e | ||
|
|
7e6115a763 | ||
|
|
a5e463464a | ||
|
|
126e065d77 | ||
|
|
1902d597ef | ||
|
|
03761642ed | ||
|
|
44c6972f31 | ||
|
|
55d56d65bc | ||
|
|
7f02b63ccc | ||
|
|
25f5776d8e | ||
|
|
952b99742e | ||
|
|
a109062b1f | ||
|
|
aa508acde4 | ||
|
|
296ec9799f | ||
|
|
34392b464c | ||
|
|
7431990f70 | ||
|
|
e7c57ada95 | ||
|
|
7003920163 | ||
|
|
332d6e9d5c | ||
|
|
95fd0e177f | ||
|
|
cf083e4f42 | ||
|
|
2f3c25cb95 | ||
|
|
df977d50b6 | ||
|
|
ff07f3a385 | ||
|
|
0303604c37 | ||
|
|
27f1fb6fc6 | ||
|
|
cd2dfc7f10 | ||
|
|
09517659b1 | ||
|
|
c27b1e4e3b | ||
|
|
58416b9883 | ||
|
|
0432c863c7 | ||
|
|
2336bbf5ef | ||
|
|
160294e05d | ||
|
|
a11ab03b99 | ||
|
|
9dbf9541e9 | ||
|
|
27908edea1 | ||
|
|
d15992bfc2 | ||
|
|
f1fdfb7971 | ||
|
|
726e5613b3 | ||
|
|
48ff0b90d3 | ||
|
|
98b823c5fc | ||
|
|
557372203f | ||
|
|
6fbe160159 | ||
|
|
d7e275a309 | ||
|
|
0704453aff | ||
|
|
3e9683d88d | ||
|
|
4722d341af | ||
|
|
b53d74285b | ||
|
|
6c1d0f1bbe | ||
|
|
cf5006617c | ||
|
|
adb5b78cb6 | ||
|
|
6779ab5e29 | ||
|
|
a513754d25 | ||
|
|
9703be932d | ||
|
|
0493f3f5f8 | ||
|
|
a664dbb507 | ||
|
|
f3a3d34f71 | ||
|
|
b584a9aeb5 | ||
|
|
c621f8606b | ||
|
|
f7e20377ec | ||
|
|
a924908f12 | ||
|
|
2035bec7ad | ||
|
|
42100e0ab1 | ||
|
|
00583e9b39 | ||
|
|
efa82dccf9 | ||
|
|
057633c2c4 | ||
|
|
d0eb6322c3 | ||
|
|
3f36e0967f | ||
|
|
a44e71aad1 | ||
|
|
57c5632de2 | ||
|
|
8c6883db34 | ||
|
|
ca5eaddfa0 | ||
|
|
0c23d9a7ff | ||
|
|
72ea0ecfd8 | ||
|
|
d67f33bcd6 | ||
|
|
e2fe897811 | ||
|
|
417dbf36c8 | ||
|
|
fd394151fd | ||
|
|
f38d8bf824 | ||
|
|
8b9c393820 | ||
|
|
8aecb3270c | ||
|
|
0dce343d4f | ||
|
|
1a9367228d | ||
|
|
554887ae14 | ||
|
|
3c0ef430db | ||
|
|
a74af66d5f | ||
|
|
619e070d80 | ||
|
|
3a4b504a5d | ||
|
|
17a2466894 | ||
|
|
a2171124e1 | ||
|
|
49b210973e | ||
|
|
aedbf45c8c | ||
|
|
c43de104ce | ||
|
|
ff1f44773a | ||
|
|
8444d066f5 | ||
|
|
f73dbc513b | ||
|
|
edb4f233b0 | ||
|
|
a910ab626a | ||
|
|
04db1c3e4d | ||
|
|
b9b4778d05 | ||
|
|
46fc1c2a1b | ||
|
|
289e571fb0 | ||
|
|
473cbba26e | ||
|
|
a29e7027ca | ||
|
|
00116b7c74 | ||
|
|
a848321842 | ||
|
|
42df157a04 | ||
|
|
af1f2bdda8 | ||
|
|
7a8d15fe47 | ||
|
|
f3b97d6bef | ||
|
|
f10c90bdba | ||
|
|
78f44dcc8a | ||
|
|
e48ab95735 | ||
|
|
c62e76ab67 | ||
|
|
80df1f5ae8 | ||
|
|
dc0393acff | ||
|
|
73f5e11039 | ||
|
|
ac1d7572e4 | ||
|
|
ec6f2e575b | ||
|
|
8b171d3ca6 | ||
|
|
136c8af878 | ||
|
|
8d0ef13505 | ||
|
|
cf4556f115 | ||
|
|
5ba8b13ccf | ||
|
|
c51d717657 | ||
|
|
d7497f9686 | ||
|
|
f35d0106b8 | ||
|
|
2b451e7893 | ||
|
|
7e27ba1d42 | ||
|
|
6ac3f30c8f | ||
|
|
1a6daa297e | ||
|
|
0f216659f9 | ||
|
|
3f2d79b7fe | ||
|
|
d87482e415 | ||
|
|
9f2e2cd1e8 | ||
|
|
cf7d30d41c | ||
|
|
e5428a0738 | ||
|
|
ebc98ec1bb | ||
|
|
1771df0109 | ||
|
|
6586c7f007 | ||
|
|
665fdbdc2b | ||
|
|
57f4d8cefb | ||
|
|
31e1fbaf40 | ||
|
|
434349cb55 | ||
|
|
4b17721a33 | ||
|
|
2fb33ba940 | ||
|
|
d81af7594c | ||
|
|
e08a88b76c | ||
|
|
ef0e95847f | ||
|
|
9bcf624382 | ||
|
|
5bd3fb494c | ||
|
|
ab793a58b6 | ||
|
|
9b492f49c7 | ||
|
|
d820b54443 | ||
|
|
640c59d9af | ||
|
|
d743ada8fd | ||
|
|
d1b6a17773 | ||
|
|
1089934486 | ||
|
|
0d5168ca0b | ||
|
|
39ead1bb49 | ||
|
|
29a644d48c | ||
|
|
3264d9a6ea | ||
|
|
21b740ccf9 | ||
|
|
6c2302f6d3 | ||
|
|
a1fbe2428f | ||
|
|
7b202c4112 | ||
|
|
44e17c440d | ||
|
|
d8330d56a0 | ||
|
|
c989de3175 | ||
|
|
39b9ba87fc | ||
|
|
b6fa480c97 | ||
|
|
ecb2a42900 | ||
|
|
dad92e723c | ||
|
|
ae74ff1db7 | ||
|
|
0a51e4ac32 | ||
|
|
80f6fb5802 | ||
|
|
9cda669b3b | ||
|
|
8b64e9b3ea | ||
|
|
950ce4c88e | ||
|
|
f67a52d9ef | ||
|
|
6f525bfd2e | ||
|
|
552d77f041 | ||
|
|
474fd8d47e | ||
|
|
5e6b4e55c5 | ||
|
|
10c6d86d13 | ||
|
|
49a5c832ea | ||
|
|
415ac07a60 | ||
|
|
aff41cfcc0 | ||
|
|
aca849ffb1 | ||
|
|
a9cbea1563 | ||
|
|
2b523fff7c | ||
|
|
e53d8226db | ||
|
|
9562756eeb | ||
|
|
a05c932973 | ||
|
|
398a292053 | ||
|
|
551a2edf4b | ||
|
|
9bf2242626 | ||
|
|
be3e985344 | ||
|
|
58abb9b165 | ||
|
|
98da9f1800 | ||
|
|
44764ec1d1 | ||
|
|
f4582d2f46 | ||
|
|
e674255ebe | ||
|
|
7b78c215ae | ||
|
|
52c6739b95 | ||
|
|
6290fb3227 | ||
|
|
ebcccd2cf7 | ||
|
|
73b6adba49 | ||
|
|
d8631c35eb | ||
|
|
4c2b17a42e | ||
|
|
483376deb2 | ||
|
|
d091f3f835 | ||
|
|
299a62804c | ||
|
|
98338565d0 | ||
|
|
682e65fead | ||
|
|
b7cbd20b6f | ||
|
|
0b70124cdd | ||
|
|
906a132e89 | ||
|
|
b9c3981261 | ||
|
|
9132d91f66 | ||
|
|
f2c1fd207e | ||
|
|
d32d6e6851 | ||
|
|
f0e396678c | ||
|
|
7787bc2c07 | ||
|
|
aec4e468e3 | ||
|
|
7d168cb6e2 | ||
|
|
d2cc04d770 | ||
|
|
ccdb189e77 | ||
|
|
b5e7a2673d | ||
|
|
e782e1262c | ||
|
|
2975b92fea | ||
|
|
031c31d367 | ||
|
|
30d8d6efd7 | ||
|
|
268298d2d8 | ||
|
|
10837fb91a | ||
|
|
7277e295e6 | ||
|
|
85ead5486c | ||
|
|
b134b080db | ||
|
|
eb395894e1 | ||
|
|
86c7f950d6 | ||
|
|
4b441dc503 | ||
|
|
1ad3d4e764 | ||
|
|
f0b0e00b06 | ||
|
|
4dbc4c5bfd | ||
|
|
d8296e5dac | ||
|
|
2d151fb353 | ||
|
|
341ba5b859 | ||
|
|
308565f8f4 | ||
|
|
5b98066d16 | ||
|
|
93ed1ee50a | ||
|
|
5961431505 | ||
|
|
d6a8c9465e | ||
|
|
dc820fced4 | ||
|
|
db3ad70a3d | ||
|
|
5b40190cbe | ||
|
|
69ad741dd4 | ||
|
|
ffb9674243 | ||
|
|
22dab733f0 | ||
|
|
ace3ac4f1d | ||
|
|
3a368809fb | ||
|
|
50daa17c2a | ||
|
|
cd308e47d2 | ||
|
|
5dfb4199ca | ||
|
|
83e173d91f | ||
|
|
fdc2f9d97e | ||
|
|
f725a46220 | ||
|
|
08e51d1c8e | ||
|
|
3f5a8085b6 | ||
|
|
4ef1f5e63f | ||
|
|
936cd6a028 | ||
|
|
3df9ae8c5e | ||
|
|
63b17022f6 | ||
|
|
d2ecb1e819 | ||
|
|
1757fa973b | ||
|
|
dccf867308 | ||
|
|
3607cddcca | ||
|
|
c9e2b384e7 | ||
|
|
11bd31c15b | ||
|
|
2c3ed38714 | ||
|
|
5504916b80 | ||
|
|
fd77ab64ad | ||
|
|
13a981c94b | ||
|
|
8d80924ba8 | ||
|
|
0a5d15db50 | ||
|
|
8f0ecc4df2 | ||
|
|
534124ec2f | ||
|
|
8c38d22b60 | ||
|
|
0555bb081a | ||
|
|
3cf8618fc7 | ||
|
|
59a66c7aaa | ||
|
|
e6f6dcc230 | ||
|
|
b1d00af58b | ||
|
|
fd0e2436da | ||
|
|
932bf4deb3 | ||
|
|
54df314936 | ||
|
|
ec10b661f3 | ||
|
|
29a723166d | ||
|
|
4e0cddcb41 | ||
|
|
cca86886f1 | ||
|
|
3602a37c96 | ||
|
|
f627f7679b | ||
|
|
154b8babc4 | ||
|
|
3f23dfb87b | ||
|
|
aac1d921c7 | ||
|
|
179b241aec | ||
|
|
f0fc4d4e73 | ||
|
|
9ae748408a | ||
|
|
8ab5a338b5 | ||
|
|
227c984d89 | ||
|
|
abd0d66e66 | ||
|
|
23eebf396c | ||
|
|
98dedfd2ff | ||
|
|
681948e71c | ||
|
|
b3578325cb | ||
|
|
b0a70b0ca6 | ||
|
|
38d0e98ff5 | ||
|
|
23f3e21ba4 | ||
|
|
1d65bab158 | ||
|
|
80f9a7c5a5 | ||
|
|
c2f90f21db | ||
|
|
a3147c5d08 | ||
|
|
7222af3284 | ||
|
|
d916e8ccaf | ||
|
|
5001272a2e | ||
|
|
d05b519f2f | ||
|
|
0f8373dd2d | ||
|
|
dfb534f1d4 | ||
|
|
7a644730a5 | ||
|
|
4066d38e4a | ||
|
|
393a95e41c | ||
|
|
7a8451adeb | ||
|
|
b8fc917016 | ||
|
|
6b8da1237c | ||
|
|
5c49e399ce | ||
|
|
32dadc008b | ||
|
|
aff6449c74 | ||
|
|
2237dc8e72 | ||
|
|
a4b34c16d7 | ||
|
|
e336947e8d | ||
|
|
bc0d783f50 | ||
|
|
4ba443e829 | ||
|
|
3d8adaab67 | ||
|
|
24f8cba0a1 | ||
|
|
607d8ad154 | ||
|
|
cde6dce939 | ||
|
|
1caaf6d75f | ||
|
|
1300cde76c | ||
|
|
310023e179 | ||
|
|
8c6d9c9e66 | ||
|
|
bd6566f85b | ||
|
|
b8d69e0f3b | ||
|
|
10e2510f0f | ||
|
|
15be53e98c | ||
|
|
ce3030268b | ||
|
|
aeffd48ccb | ||
|
|
2f1975636a | ||
|
|
b7be16eac7 | ||
|
|
d55afd57b5 | ||
|
|
22b1460595 | ||
|
|
efc601a76d | ||
|
|
ffd9ace84e | ||
|
|
251cddfa96 | ||
|
|
d9b89a8ebe | ||
|
|
a1c72d8890 | ||
|
|
9fe3d8b2e2 | ||
|
|
52667c1166 | ||
|
|
de1f18417a | ||
|
|
acd8b3ddc1 | ||
|
|
a65d2d4078 | ||
|
|
9f43716723 | ||
|
|
d6235e714e | ||
|
|
cdf9a8e84d | ||
|
|
437412362e | ||
|
|
7a364e0593 | ||
|
|
65b90df4b8 | ||
|
|
38fd9f2685 | ||
|
|
de3e3d74ce | ||
|
|
becaf20ee9 | ||
|
|
3f16b340fc | ||
|
|
5c70d37da6 | ||
|
|
c0b6eac0c2 | ||
|
|
a34c0e262b | ||
|
|
31a1aae02e | ||
|
|
b208550e6e | ||
|
|
cd1304aaae | ||
|
|
767ac44e99 | ||
|
|
28240adaf5 | ||
|
|
9cdf7678bb | ||
|
|
300b5cad44 | ||
|
|
72ec3fd48d | ||
|
|
e1712eb44a | ||
|
|
552063aeac | ||
|
|
dad58ba622 | ||
|
|
bbc49ca805 | ||
|
|
38bb1569af | ||
|
|
e07c0ec829 | ||
|
|
6dbb4e6737 | ||
|
|
863cc1bae3 | ||
|
|
60179e9ab9 | ||
|
|
a512a5b115 | ||
|
|
46647373ee | ||
|
|
4b7e8f5f83 | ||
|
|
20be8980e1 | ||
|
|
34139f4dce | ||
|
|
9affb99899 | ||
|
|
f395a0f8c5 | ||
|
|
80f10ce824 | ||
|
|
46a266fa5c | ||
|
|
4f2df30f1d | ||
|
|
c1b16217f2 | ||
|
|
34fb85a9d7 | ||
|
|
6bc6fd9cbc | ||
|
|
945f1e7580 | ||
|
|
ae90c32f01 | ||
|
|
25e0053a13 | ||
|
|
88255fd776 | ||
|
|
e0be143ed5 | ||
|
|
dd4e88525e | ||
|
|
195e802f7c | ||
|
|
0c3aed0083 | ||
|
|
004e7ad0d0 | ||
|
|
8b0bd11fc8 |
2
.eslintignore
Normal file
2
.eslintignore
Normal file
@@ -0,0 +1,2 @@
|
||||
examples/Jugl.js
|
||||
examples/resources/
|
||||
@@ -1,5 +1,4 @@
|
||||
sudo: required
|
||||
dist: trusty
|
||||
sudo: false
|
||||
|
||||
language: node_js
|
||||
|
||||
@@ -14,11 +13,11 @@ env:
|
||||
|
||||
before_install:
|
||||
- "npm prune"
|
||||
- "sudo pip install -r requirements.txt"
|
||||
|
||||
before_script:
|
||||
- "rm src/ol/renderer/webgl/*shader.js"
|
||||
- "sh -e /etc/init.d/xvfb start"
|
||||
- "npm ls"
|
||||
|
||||
script: "make ci"
|
||||
|
||||
|
||||
@@ -81,8 +81,7 @@ include:
|
||||
|
||||
OpenLayers 3 follows [Google's JavaScript Style
|
||||
Guide](http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml).
|
||||
This is checked using the [Closure
|
||||
Linter](https://developers.google.com/closure/utilities/) in strict mode. You
|
||||
This is checked using [ESLint](http://eslint.org/), you
|
||||
can run the linter locally on your machine before committing using the `lint`
|
||||
target:
|
||||
|
||||
@@ -102,20 +101,6 @@ style of the existing OpenLayers 3 code, which includes:
|
||||
|
||||
* Do not use assignments inside expressions.
|
||||
|
||||
* Avoid the use of `goog.array.clone` with arrays (use slice instead).
|
||||
|
||||
* Use `array.length = 0` instead of `goog.array.clear`.
|
||||
|
||||
* Use `v !== undefined` instead of `goog.isDef(v)` and `v === null` instead of
|
||||
`goog.isNull(v)`.
|
||||
|
||||
* Use ECMAScript 5.1 functions instead of the `goog` equivalents. For example,
|
||||
use `Object.keys(obj)` instead of `goog.object.getKeys(obj)`, `arr.forEach(f)`
|
||||
instead of `goog.array.forEach(arr, f)`, etc ...
|
||||
|
||||
* Use bracket notation instead of `goog.object.set` and `goog.object.get` (with
|
||||
two arguments).
|
||||
|
||||
* Use uppercase for `@const` variables.
|
||||
|
||||
### Configure your editor
|
||||
|
||||
@@ -25,11 +25,11 @@ The minimum requirements are:
|
||||
|
||||
* GNU Make
|
||||
* Git
|
||||
* [Node.js](http://nodejs.org/) (0.10.x or higher)
|
||||
* Python 2.6 or 2.7 with a couple of extra modules (see below)
|
||||
* [Node.js](http://nodejs.org/) (higher than 0.12.x)
|
||||
* Python 2.6 or 2.7
|
||||
* Java 7 (JRE and JDK)
|
||||
|
||||
The executables `git`, `node`, `python` and `java` should be in your `PATH`.
|
||||
The executables `git`, `node`, and `java` should be in your `PATH`.
|
||||
|
||||
You can check your configuration by running:
|
||||
|
||||
@@ -39,17 +39,6 @@ To install the Node.js dependencies run
|
||||
|
||||
$ npm install
|
||||
|
||||
To install the extra Python modules, run:
|
||||
|
||||
$ sudo pip install -r requirements.txt
|
||||
or
|
||||
|
||||
$ cat requirements.txt | sudo xargs easy_install
|
||||
|
||||
depending on your OS and Python installation.
|
||||
|
||||
(You can also install the Python modules in a Python virtual environment if you want to.)
|
||||
|
||||
## Working with the build tool
|
||||
|
||||
As an ol3 developer you will use `make` to run build targets defined in the
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright 2005-2015 OpenLayers Contributors. All rights reserved.
|
||||
Copyright 2005-2016 OpenLayers Contributors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
31
Makefile
31
Makefile
@@ -93,8 +93,7 @@ compile-examples: build/compiled-examples/all.combined.js
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f build/timestamps/gjslint-timestamp
|
||||
rm -f build/timestamps/jshint-timestamp
|
||||
rm -f build/timestamps/eslint-timestamp
|
||||
rm -f build/timestamps/check-*-timestamp
|
||||
rm -f build/ol.css
|
||||
rm -f build/ol.js
|
||||
@@ -120,9 +119,8 @@ examples: $(BUILD_EXAMPLES)
|
||||
install: build/timestamps/node-modules-timestamp
|
||||
|
||||
.PHONY: lint
|
||||
lint: build/timestamps/gjslint-timestamp build/timestamps/jshint-timestamp \
|
||||
build/timestamps/check-requires-timestamp \
|
||||
build/timestamps/check-whitespace-timestamp
|
||||
lint: build/timestamps/eslint-timestamp \
|
||||
build/timestamps/check-requires-timestamp
|
||||
|
||||
.PHONY: npm-install
|
||||
npm-install: build/timestamps/node-modules-timestamp
|
||||
@@ -183,7 +181,7 @@ build/timestamps/check-%-timestamp: $(BUILD_HOSTED)/examples/%.html \
|
||||
$(BUILD_HOSTED)/build/ol.js \
|
||||
$(BUILD_HOSTED)/css/ol.css
|
||||
@mkdir -p $(@D)
|
||||
./node_modules/.bin/phantomjs --ssl-protocol=any --ignore-ssl-errors=true bin/check-example.js $(addsuffix ?mode=advanced, $<)
|
||||
./node_modules/.bin/phantomjs --local-to-remote-url-access=true --ssl-protocol=any --ignore-ssl-errors=true bin/check-example.js $<
|
||||
@touch $@
|
||||
|
||||
build/timestamps/check-requires-timestamp: $(SRC_JS) $(EXAMPLES_JS) \
|
||||
@@ -193,13 +191,6 @@ build/timestamps/check-requires-timestamp: $(SRC_JS) $(EXAMPLES_JS) \
|
||||
@python bin/check-requires.py $(CLOSURE_LIB) $^
|
||||
@touch $@
|
||||
|
||||
build/timestamps/check-whitespace-timestamp: $(SRC_JS) $(EXAMPLES_JS) \
|
||||
$(SPEC_JS) $(SPEC_RENDERING_JS) \
|
||||
$(SRC_JSDOC)
|
||||
@mkdir -p $(@D)
|
||||
@python bin/check-whitespace.py $^
|
||||
@touch $@
|
||||
|
||||
build/compiled-examples/all.js: $(EXAMPLES_JS)
|
||||
@mkdir -p $(@D)
|
||||
@python bin/combine-examples.py $^ > $@
|
||||
@@ -231,13 +222,6 @@ build/timestamps/jsdoc-$(BRANCH)-timestamp: config/jsdoc/api/index.md \
|
||||
./node_modules/.bin/jsdoc config/jsdoc/api/index.md -c config/jsdoc/api/conf.json -d $(BUILD_HOSTED)/apidoc
|
||||
@touch $@
|
||||
|
||||
build/timestamps/gjslint-timestamp: $(SRC_JS) $(SPEC_JS) $(SPEC_RENDERING_JS) \
|
||||
$(EXAMPLES_JS)
|
||||
@mkdir -p $(@D)
|
||||
@echo "Running gjslint..."
|
||||
@gjslint --jslint_error=all --custom_jsdoc_tags=event,fires,function,classdesc,api,observable --strict $?
|
||||
@touch $@
|
||||
|
||||
$(BUILD_HOSTED_EXAMPLES_JS): $(BUILD_HOSTED)/examples/%.js: build/examples/%.js
|
||||
@mkdir -p $(@D)
|
||||
@python bin/split-example.py $< $(@D)
|
||||
@@ -271,13 +255,12 @@ $(BUILD_HOSTED)/build/ol-deps.js: host-libraries
|
||||
--root_with_prefix "$(BUILD_HOSTED)/closure-library/third_party ../../third_party" \
|
||||
--output_file $@
|
||||
|
||||
build/timestamps/jshint-timestamp: $(SRC_JS) $(SPEC_JS) $(SPEC_RENDERING_JS) \
|
||||
build/timestamps/eslint-timestamp: $(SRC_JS) $(SPEC_JS) $(SPEC_RENDERING_JS) \
|
||||
$(TASKS_JS) $(EXAMPLES_JS) \
|
||||
examples/resources/common.js \
|
||||
build/timestamps/node-modules-timestamp
|
||||
@mkdir -p $(@D)
|
||||
@echo "Running jshint..."
|
||||
@./node_modules/.bin/jshint --verbose $?
|
||||
@echo "Running eslint..."
|
||||
@./node_modules/.bin/eslint $?
|
||||
@touch $@
|
||||
|
||||
build/timestamps/node-modules-timestamp: package.json
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
[](http://travis-ci.org/#!/openlayers/ol3)
|
||||
[](https://coveralls.io/r/openlayers/ol3?branch=master)
|
||||
[](http://osgeo.org/)
|
||||
|
||||
[OpenLayers 3](http://openlayers.org/) is a high-performance, feature-packed library for creating interactive maps on the web.
|
||||
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
import logging
|
||||
import re
|
||||
import sys
|
||||
|
||||
logging.basicConfig(format='%(asctime)s %(name)s: %(message)s',
|
||||
level=logging.INFO)
|
||||
|
||||
logger = logging.getLogger('check-whitespace')
|
||||
|
||||
CR_RE = re.compile(r'\r')
|
||||
LEADING_WHITESPACE_RE = re.compile(r'\s+')
|
||||
TRAILING_WHITESPACE_RE = re.compile(r'\s+\n\Z')
|
||||
NO_NEWLINE_RE = re.compile(r'[^\n]\Z')
|
||||
ALL_WHITESPACE_RE = re.compile(r'\s+\Z')
|
||||
|
||||
|
||||
def check_whitespace(*filenames):
|
||||
errors = 0
|
||||
for filename in sorted(filenames):
|
||||
whitespace = False
|
||||
for lineno, line in enumerate(open(filename, 'rU')):
|
||||
if lineno == 0 and LEADING_WHITESPACE_RE.match(line):
|
||||
logger.info('%s:%d: leading whitespace', filename, lineno + 1)
|
||||
errors += 1
|
||||
if CR_RE.search(line):
|
||||
logger.info('%s:%d: carriage return character in line',
|
||||
filename, lineno + 1)
|
||||
errors += 1
|
||||
if TRAILING_WHITESPACE_RE.search(line):
|
||||
logger.info('%s:%d: trailing whitespace', filename, lineno + 1)
|
||||
errors += 1
|
||||
if NO_NEWLINE_RE.search(line):
|
||||
logger.info('%s:%d: no newline at end of file', filename,
|
||||
lineno + 1)
|
||||
errors += 1
|
||||
whitespace = ALL_WHITESPACE_RE.match(line)
|
||||
if whitespace:
|
||||
logger.info('%s: trailing whitespace at end of file', filename)
|
||||
errors += 1
|
||||
return errors
|
||||
|
||||
if __name__ == "__main__":
|
||||
errors = check_whitespace(*sys.argv[1:])
|
||||
if errors > 0:
|
||||
logger.error('%d whitespace errors' % (errors,))
|
||||
sys.exit(1)
|
||||
@@ -1,5 +1,73 @@
|
||||
## Upgrade notes
|
||||
|
||||
### v3.14.0
|
||||
|
||||
#### Internet Explorer 9 support
|
||||
|
||||
As of this release, OpenLayers requires a `requestAnimationFrame`/`cancelAnimationFrame` polyfill for IE 9 support. See http://cdn.polyfill.io/v2/docs/features/#requestAnimationFrame.
|
||||
|
||||
#### Layer pre-/postcompose event changes
|
||||
|
||||
It is the responsibility of the application to undo any canvas transform changes at the end of a layer 'precompose' or 'postcompose' handler. Previously, it was ok to set a null transform. The API now guarantees a device pixel coordinate system on the canvas with its origin in the top left corner of the map. However, applications should not rely on the underlying canvas being the same size as the visible viewport.
|
||||
|
||||
Old code:
|
||||
```js
|
||||
layer.on('precompose', function(e) {
|
||||
// rely on canvas dimensions to move coordinate origin to center
|
||||
e.context.translate(e.context.canvas.width / 2, e.context.canvas.height / 2);
|
||||
e.context.scale(3, 3);
|
||||
// draw an x in the center of the viewport
|
||||
e.context.moveTo(-20, -20);
|
||||
e.context.lineTo(20, 20);
|
||||
e.context.moveTo(-20, 20);
|
||||
e.context.lineTo(20, -20);
|
||||
// rely on the canvas having a null transform
|
||||
e.context.setTransform(1, 0, 0, 1, 0, 0);
|
||||
});
|
||||
```
|
||||
New code:
|
||||
```js
|
||||
layer.on('precompose', function(e) {
|
||||
// use map size and pixel ratio to move coordinate origin to center
|
||||
var size = map.getSize();
|
||||
var pixelRatio = e.frameState.pixelRatio;
|
||||
e.context.translate(size[0] / 2 * pixelRatio, size[1] / 2 * pixelRatio);
|
||||
e.context.scale(3, 3);
|
||||
// draw an x in the center of the viewport
|
||||
e.context.moveTo(-20, -20);
|
||||
e.context.lineTo(20, 20);
|
||||
e.context.moveTo(-20, 20);
|
||||
e.context.lineTo(20, -20);
|
||||
// undo all transforms
|
||||
e.context.scale(1 / 3, 1 / 3);
|
||||
e.context.translate(-size[0] / 2 * pixelRatio, -size[1] / 2 * pixelRatio);
|
||||
});
|
||||
```
|
||||
|
||||
### v3.13.0
|
||||
|
||||
#### `proj4js` integration
|
||||
|
||||
Before this release, OpenLayers depended on the global proj4 namespace. When using a module loader like Browserify, you might not want to depend on the global `proj4` namespace. You can use the `ol.proj.setProj4` function to set the proj4 function object. For example in a browserify ES6 environment:
|
||||
|
||||
```js
|
||||
import ol from 'openlayers';
|
||||
import proj4 from 'proj4';
|
||||
ol.proj.setProj4(proj4);
|
||||
```
|
||||
|
||||
#### `ol.source.TileJSON` changes
|
||||
|
||||
The `ol.source.TileJSON` now uses `XMLHttpRequest` to load the TileJSON instead of JSONP with callback.
|
||||
When using server without proper CORS support, `jsonp: true` option can be passed to the constructor to get the same behavior as before:
|
||||
```js
|
||||
new ol.source.TileJSON({
|
||||
url: 'http://serverwithoutcors.com/tilejson.json',
|
||||
jsonp: true
|
||||
})
|
||||
```
|
||||
Also for Mapbox v3, make sure you use urls ending with `.json` (which are able to handle both `XMLHttpRequest` and JSONP) instead of `.jsonp`.
|
||||
|
||||
### v3.12.0
|
||||
|
||||
#### `ol.Map#forEachFeatureAtPixel` changes
|
||||
|
||||
11
changelog/v3.12.1.md
Normal file
11
changelog/v3.12.1.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# v3.12.1
|
||||
|
||||
## Summary
|
||||
|
||||
The v3.12.1 release is a patch release that addresses a few regressions in the v3.12.0 release. See the [v3.12.0 release notes](https://github.com/openlayers/ol3/releases/tag/v3.12.0) for details on upgrading from v3.11.
|
||||
|
||||
## Fixes
|
||||
|
||||
* [#4578](https://github.com/openlayers/ol3/pull/4578) - Fix apidoc landing page markup ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4570](https://github.com/openlayers/ol3/pull/4570) - Rename defaultSort to numberSafeCompareFunction on ol.array ([@bartvde](https://github.com/bartvde))
|
||||
* [#4567](https://github.com/openlayers/ol3/pull/4567) - Always pass on a compare function to sort ([@bartvde](https://github.com/bartvde))
|
||||
109
changelog/v3.13.0.md
Normal file
109
changelog/v3.13.0.md
Normal file
@@ -0,0 +1,109 @@
|
||||
# v3.13.0
|
||||
|
||||
## Summary
|
||||
|
||||
The v3.13.0 release includes features and fixes from 68 pull requests since the v3.12.1 release. New features and improvements include:
|
||||
|
||||
* Improved tiles rendering for the canvas renderer
|
||||
* Improved MapQuest rendering
|
||||
* Add color option to ol.style.Icon
|
||||
* Load TileJSON sources via XMLHttpRequest by default
|
||||
* Add new ol.geom.LineString#getCoordinateAt function
|
||||
* Simplify meters per unit handling
|
||||
* Use ESLint as a replacement for gjslint.py and jshint
|
||||
|
||||
## Upgrade notes
|
||||
|
||||
#### `proj4js` integration
|
||||
|
||||
Before this release, OpenLayers depended on the global proj4 namespace. When using a module loader like Browserify, you might not want to depend on the global `proj4` namespace. You can use the `ol.proj.setProj4` function to set the proj4 function object. For example in a browserify ES6 environment:
|
||||
|
||||
```js
|
||||
import ol from 'openlayers';
|
||||
import proj4 from 'proj4';
|
||||
ol.proj.setProj4(proj4);
|
||||
```
|
||||
|
||||
#### `ol.source.TileJSON` changes
|
||||
|
||||
The `ol.source.TileJSON` now uses `XMLHttpRequest` to load the TileJSON instead of JSONP with callback.
|
||||
When using server without proper CORS support, `jsonp: true` option can be passed to the constructor to get the same behavior as before:
|
||||
```js
|
||||
new ol.source.TileJSON({
|
||||
url: 'http://serverwithoutcors.com/tilejson.json',
|
||||
jsonp: true
|
||||
})
|
||||
```
|
||||
Also for Mapbox v3, make sure you use urls ending with `.json` (which are able to handle both `XMLHttpRequest` and JSONP) instead of `.jsonp`.
|
||||
|
||||
|
||||
## Full list of changes
|
||||
|
||||
* [#4694](https://github.com/openlayers/ol3/pull/4694) - Fix eslint errors in wms-time example ([@fredj](https://github.com/fredj))
|
||||
* [#4527](https://github.com/openlayers/ol3/pull/4527) - Add support for smooth TileWMS dimensions ([@bartvde](https://github.com/bartvde))
|
||||
* [#4691](https://github.com/openlayers/ol3/pull/4691) - Updated Bing Maps key. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4673](https://github.com/openlayers/ol3/pull/4673) - Respect fixed tile url functions when setting url(s) ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4689](https://github.com/openlayers/ol3/pull/4689) - Revert "Do not render in handleDownEvent" ([@openlayers](https://github.com/openlayers))
|
||||
* [#4688](https://github.com/openlayers/ol3/pull/4688) - Give map a focus-outline in accessible-example ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4642](https://github.com/openlayers/ol3/pull/4642) - Move the icon style color to its own example ([@alexbrault](https://github.com/alexbrault))
|
||||
* [#4685](https://github.com/openlayers/ol3/pull/4685) - Remove bin/check-whitespace.py ([@fredj](https://github.com/fredj))
|
||||
* [#4684](https://github.com/openlayers/ol3/pull/4684) - Update eslint-config-openlayers to version 3.0.0 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4677](https://github.com/openlayers/ol3/pull/4677) - Make pixel projection handling work in compiled mode ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4639](https://github.com/openlayers/ol3/pull/4639) - Remove use of goog.bind and use ES5 .bind. ([@nicholas-l](https://github.com/nicholas-l))
|
||||
* [#4655](https://github.com/openlayers/ol3/pull/4655) - Update browserify to version 13.0.0 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4666](https://github.com/openlayers/ol3/pull/4666) - Add a 'boxdrag' event to ol.interaction.DragBox. Resolves #4563 . ([@WeaveTeam](https://github.com/WeaveTeam))
|
||||
* [#4669](https://github.com/openlayers/ol3/pull/4669) - Remove reference to Closure Linter in CONTRIBUTING.md ([@fredj](https://github.com/fredj))
|
||||
* [#4665](https://github.com/openlayers/ol3/pull/4665) - Update istanbul to version 0.4.2 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4663](https://github.com/openlayers/ol3/pull/4663) - Update glob to version 6.0.4 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4667](https://github.com/openlayers/ol3/pull/4667) - Fix rendering of transparent MapQuest layer type ([@klokantech](https://github.com/klokantech))
|
||||
* [#4661](https://github.com/openlayers/ol3/pull/4661) - Fixes #4654 Developer Documentation Updated ([@gaf-ag](https://github.com/gaf-ag))
|
||||
* [#4658](https://github.com/openlayers/ol3/pull/4658) - Update jquery to version 2.2.0 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4659](https://github.com/openlayers/ol3/pull/4659) - Make sure icons show up in Safari ([@bartvde](https://github.com/bartvde))
|
||||
* [#4652](https://github.com/openlayers/ol3/pull/4652) - Use map.getTargetElement instead of map.getTarget ([@fredj](https://github.com/fredj))
|
||||
* [#4649](https://github.com/openlayers/ol3/pull/4649) - Missing parameter description for ol.source.Tile#getOpaque ([@klokantech](https://github.com/klokantech))
|
||||
* [#4602](https://github.com/openlayers/ol3/pull/4602) - Use ESLint. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4628](https://github.com/openlayers/ol3/pull/4628) - Fix for reprojecting opaque tile sources ([@klokantech](https://github.com/klokantech))
|
||||
* [#4618](https://github.com/openlayers/ol3/pull/4618) - Update resemblejs to version 2.1.0 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4647](https://github.com/openlayers/ol3/pull/4647) - Proper rounding for possibly negative numbers ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4641](https://github.com/openlayers/ol3/pull/4641) - Remove extra options from icon example. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4629](https://github.com/openlayers/ol3/pull/4629) - Simplify scaleline calculation ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4457](https://github.com/openlayers/ol3/pull/4457) - Add color option to ol.style.Icon ([@alexbrault](https://github.com/alexbrault))
|
||||
* [#4638](https://github.com/openlayers/ol3/pull/4638) - Do not rely on projection extent ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4635](https://github.com/openlayers/ol3/pull/4635) - Update async to version 1.5.2 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4581](https://github.com/openlayers/ol3/pull/4581) - Do not render in handleDownEvent ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4541](https://github.com/openlayers/ol3/pull/4541) - Add new ol.geom.LineString#getCoordinateAt function ([@fredj](https://github.com/fredj))
|
||||
* [#4489](https://github.com/openlayers/ol3/pull/4489) - Update phantomjs to version 1.9.19 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4625](https://github.com/openlayers/ol3/pull/4625) - Use XHR by default to load TileJSON in ol.source.TileJSON ([@klokantech](https://github.com/klokantech))
|
||||
* [#4622](https://github.com/openlayers/ol3/pull/4622) - Update fs-extra to version 0.26.4 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4630](https://github.com/openlayers/ol3/pull/4630) - Simplify meters per unit handling ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4490](https://github.com/openlayers/ol3/pull/4490) - Update istanbul to version 0.4.1 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4574](https://github.com/openlayers/ol3/pull/4574) - Added boxEndCondition to DragBoxOptions to replace the hardcoded chec… ([@WeaveTeam](https://github.com/WeaveTeam))
|
||||
* [#4553](https://github.com/openlayers/ol3/pull/4553) - Update mustache to version 2.2.1 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4626](https://github.com/openlayers/ol3/pull/4626) - Fixed documentation error ([@simonseyock](https://github.com/simonseyock))
|
||||
* [#4606](https://github.com/openlayers/ol3/pull/4606) - Include originating MapBrowserEvent in ol.DragBoxEvent ([@fredj](https://github.com/fredj))
|
||||
* [#4614](https://github.com/openlayers/ol3/pull/4614) - Remove checksum interface. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4613](https://github.com/openlayers/ol3/pull/4613) - Include own layer in layerFilter and only select unselected features ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4612](https://github.com/openlayers/ol3/pull/4612) - Set oli.source.VectorEvent#feature to ol.Feature|undefined ([@fredj](https://github.com/fredj))
|
||||
* [#4620](https://github.com/openlayers/ol3/pull/4620) - Fix olx.format.PolylineOptions#factor type ([@fredj](https://github.com/fredj))
|
||||
* [#4621](https://github.com/openlayers/ol3/pull/4621) - Fix olx.format.GPXOptions#readExtensions type ([@fredj](https://github.com/fredj))
|
||||
* [#4619](https://github.com/openlayers/ol3/pull/4619) - Add option to load TileJSON via XHR ([@klokantech](https://github.com/klokantech))
|
||||
* [#4617](https://github.com/openlayers/ol3/pull/4617) - Add missing return type to GeoJSON format ([@gberaudo](https://github.com/gberaudo))
|
||||
* [#4615](https://github.com/openlayers/ol3/pull/4615) - Adjust copyright to include 2016 ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4616](https://github.com/openlayers/ol3/pull/4616) - Update closure-util to version 1.10.0 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4596](https://github.com/openlayers/ol3/pull/4596) - Use consistent tile coordinate keys ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4609](https://github.com/openlayers/ol3/pull/4609) - Add ol.proj.setProj4 function ([@bartvde](https://github.com/bartvde))
|
||||
* [#4603](https://github.com/openlayers/ol3/pull/4603) - Update async to version 1.5.1 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4604](https://github.com/openlayers/ol3/pull/4604) - Update clean-css to version 3.4.9 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4600](https://github.com/openlayers/ol3/pull/4600) - Update glob to version 6.0.3 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4595](https://github.com/openlayers/ol3/pull/4595) - Pass 'opaque' option on to superclass ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4598](https://github.com/openlayers/ol3/pull/4598) - Make ol.source.Tile#getTilePixelRatio work correctly for all sources ([@klokantech](https://github.com/klokantech))
|
||||
* [#4594](https://github.com/openlayers/ol3/pull/4594) - Fix for TileQueue gradually choking up when using raster reprojection ([@klokantech](https://github.com/klokantech))
|
||||
* [#4557](https://github.com/openlayers/ol3/pull/4557) - Conditionally render tiles to a separate tile canvas ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4580](https://github.com/openlayers/ol3/pull/4580) - Update fs-extra to version 0.26.3 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4579](https://github.com/openlayers/ol3/pull/4579) - Release v3.12.1 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4578](https://github.com/openlayers/ol3/pull/4578) - Fix apidoc landing page markup ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4575](https://github.com/openlayers/ol3/pull/4575) - Update rbush to version 1.4.2 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4571](https://github.com/openlayers/ol3/pull/4571) - Correct typedef of selectinteraction options obj ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4570](https://github.com/openlayers/ol3/pull/4570) - Rename defaultSort to numberSafeCompareFunction on ol.array ([@bartvde](https://github.com/bartvde))
|
||||
* [#4567](https://github.com/openlayers/ol3/pull/4567) - Always pass on a compare function to sort ([@bartvde](https://github.com/bartvde))
|
||||
* [#4001](https://github.com/openlayers/ol3/pull/4001) - Export PDF's using jsPDF ([@bartvde](https://github.com/bartvde))
|
||||
10
changelog/v3.13.1.md
Normal file
10
changelog/v3.13.1.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# v3.13.1
|
||||
|
||||
## Summary
|
||||
|
||||
The v3.13.1 release is a patch release that addresses a few regressions in the v3.13.0 release. See the [v3.13.0 release notes](https://github.com/openlayers/ol3/releases/tag/v3.13.0) for details on upgrading from v3.12.
|
||||
|
||||
## Fixes
|
||||
|
||||
* [#4736](https://github.com/openlayers/ol3/pull/4736) - Properly detect feature on unmanaged layer for toggle selection ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4777](https://github.com/openlayers/ol3/pull/4777) - Fix source.UrlTile URL expansion ([@gberaudo](https://github.com/gberaudo))
|
||||
154
changelog/v3.14.0.md
Normal file
154
changelog/v3.14.0.md
Normal file
@@ -0,0 +1,154 @@
|
||||
# v3.14.0
|
||||
|
||||
## Summary
|
||||
|
||||
The v3.14.0 release includes features and fixes from 93 pull requests since the v3.13.1 release. New features and improvements include:
|
||||
|
||||
* New `source` option for the `ol.control.FullScreen`, to allow including other elements besides the map in a full screen view (#4679).
|
||||
* New `target` property for the Drag&Drop interaction allows using a different drop target than the map viewport (#4876).
|
||||
* `ol.style.RegularShape` has a new `rotateWithView` option, for controlling how regular shape symbols are rendered on rotated views (#4698).
|
||||
* New `layers` option for `ol.format.WMSGetFeatureInfo` format, to selectively only read features from specific layers (#4700).
|
||||
* New `precision` parameter for formatting coordinates with `ol.coordinate.toStringHDMS` (#4787).
|
||||
* Smarter tile queue for improved tile loading user experience when more than one tile layer is used (#4794).
|
||||
* Improved rendering performance for tile layers by rendering tiles directly to the map canvas (#4597).
|
||||
* The `goog.events` event system was replaced with our own lightweight event system. This significally reduces the build size (#4711). Replacement of other `goog.*` components with ES5 features or custom code marks a huge step towards the complete removal of the Closure Library dependency.
|
||||
|
||||
## Upgrade notes
|
||||
|
||||
#### Internet Explorer 9 support
|
||||
|
||||
As of this release, OpenLayers requires a `requestAnimationFrame`/`cancelAnimationFrame` polyfill for IE 9 support. See http://cdn.polyfill.io/v2/docs/features/#requestAnimationFrame.
|
||||
|
||||
#### Layer pre-/postcompose event changes
|
||||
|
||||
It is the responsibility of the application to undo any canvas transform changes at the end of a layer 'precompose' or 'postcompose' handler. Previously, it was ok to set a null transform. The API now guarantees a device pixel coordinate system on the canvas with its origin in the top left corner of the map. However, applications should not rely on the underlying canvas being the same size as the visible viewport.
|
||||
|
||||
Old code:
|
||||
```js
|
||||
layer.on('precompose', function(e) {
|
||||
// rely on canvas dimensions to move coordinate origin to center
|
||||
e.context.translate(e.context.canvas.width / 2, e.context.canvas.height / 2);
|
||||
e.context.scale(3, 3);
|
||||
// draw an x in the center of the viewport
|
||||
e.context.moveTo(-20, -20);
|
||||
e.context.lineTo(20, 20);
|
||||
e.context.moveTo(-20, 20);
|
||||
e.context.lineTo(20, -20);
|
||||
// rely on the canvas having a null transform
|
||||
e.context.setTransform(1, 0, 0, 1, 0, 0);
|
||||
});
|
||||
```
|
||||
New code:
|
||||
```js
|
||||
layer.on('precompose', function(e) {
|
||||
// use map size and pixel ratio to move coordinate origin to center
|
||||
var size = map.getSize();
|
||||
var pixelRatio = e.frameState.pixelRatio;
|
||||
e.context.translate(size[0] / 2 * pixelRatio, size[1] / 2 * pixelRatio);
|
||||
e.context.scale(3, 3);
|
||||
// draw an x in the center of the viewport
|
||||
e.context.moveTo(-20, -20);
|
||||
e.context.lineTo(20, 20);
|
||||
e.context.moveTo(-20, 20);
|
||||
e.context.lineTo(20, -20);
|
||||
// undo all transforms
|
||||
e.context.scale(1 / 3, 1 / 3);
|
||||
e.context.translate(-size[0] / 2 * pixelRatio, -size[1] / 2 * pixelRatio);
|
||||
});
|
||||
```
|
||||
|
||||
## Full list of changes
|
||||
|
||||
* [#4896](https://github.com/openlayers/ol3/pull/4896) - Ignore XML sequence when comparing GML ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4890](https://github.com/openlayers/ol3/pull/4890) - ol.format.KML cleanup ([@fredj](https://github.com/fredj))
|
||||
* [#4894](https://github.com/openlayers/ol3/pull/4894) - Only run raster operations after image sources have loaded. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4892](https://github.com/openlayers/ol3/pull/4892) - Stricter check for ImageData constructor ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4891](https://github.com/openlayers/ol3/pull/4891) - Fix tests so they all pass in IE9 ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4889](https://github.com/openlayers/ol3/pull/4889) - Use requestAnimation polyfill for examples and update release notes ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4887](https://github.com/openlayers/ol3/pull/4887) - Use less aggressive DOM function overrides ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4885](https://github.com/openlayers/ol3/pull/4885) - Mark overlayContainer and overlayContainerStopEvent as non-nullable ([@fredj](https://github.com/fredj))
|
||||
* [#4884](https://github.com/openlayers/ol3/pull/4884) - Remove use of goog.math.isFiniteNumber() ([@fredj](https://github.com/fredj))
|
||||
* [#4881](https://github.com/openlayers/ol3/pull/4881) - Update jquery to version 2.2.1 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4780](https://github.com/openlayers/ol3/pull/4780) - Adapt the code for the new closure-compiler version ([@fredj](https://github.com/fredj))
|
||||
* [#3453](https://github.com/openlayers/ol3/pull/3453) - Consider multi in add/remove/toggle select logic ([@bjornharrtell](https://github.com/bjornharrtell))
|
||||
* [#4876](https://github.com/openlayers/ol3/pull/4876) - Add `target` property to Drag&Drop interaction ([@tsauerwein](https://github.com/tsauerwein))
|
||||
* [#4854](https://github.com/openlayers/ol3/pull/4854) - Always report skipped feature hits for the original layer ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4877](https://github.com/openlayers/ol3/pull/4877) - Update eslint to version 2.2.0 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4870](https://github.com/openlayers/ol3/pull/4870) - Reuse dragListenerKeys_ local variable ([@fredj](https://github.com/fredj))
|
||||
* [#4721](https://github.com/openlayers/ol3/pull/4721) - Fix reprojection of raster sources with gutter ([@klokantech](https://github.com/klokantech))
|
||||
* [#4874](https://github.com/openlayers/ol3/pull/4874) - Assert we have a feature id ([@bartvde](https://github.com/bartvde))
|
||||
* [#4869](https://github.com/openlayers/ol3/pull/4869) - Improve precision of ol.reproj.render ([@klokantech](https://github.com/klokantech))
|
||||
* [#4866](https://github.com/openlayers/ol3/pull/4866) - Use requestAnimationFrame polyfill (for IE9) ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4863](https://github.com/openlayers/ol3/pull/4863) - Remove use of goog.dom.createElement ([@fredj](https://github.com/fredj))
|
||||
* [#4864](https://github.com/openlayers/ol3/pull/4864) - Use querySelectorAll instead of goog.dom.getElementsByClass ([@fredj](https://github.com/fredj))
|
||||
* [#4597](https://github.com/openlayers/ol3/pull/4597) - Render tiles directly to the map canvas ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4862](https://github.com/openlayers/ol3/pull/4862) - Add OSGeo badge ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4845](https://github.com/openlayers/ol3/pull/4845) - Fix geolocation error cast ([@gberaudo](https://github.com/gberaudo))
|
||||
* [#4851](https://github.com/openlayers/ol3/pull/4851) - Don't use goog.isBoolean() ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4852](https://github.com/openlayers/ol3/pull/4852) - Don't use goog.isString() ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4849](https://github.com/openlayers/ol3/pull/4849) - Fix docs of LogoOptions.prototype.src ([@openlayers](https://github.com/openlayers))
|
||||
* [#4794](https://github.com/openlayers/ol3/pull/4794) - Make tile loading count no longer depend on source count ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4843](https://github.com/openlayers/ol3/pull/4843) - Remove use of goog.dom.getParentElement ([@fredj](https://github.com/fredj))
|
||||
* [#4839](https://github.com/openlayers/ol3/pull/4839) - Add template type to ol.Collection ([@fredj](https://github.com/fredj))
|
||||
* [#4847](https://github.com/openlayers/ol3/pull/4847) - Update eslint to version 2.1.0 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4632](https://github.com/openlayers/ol3/pull/4632) - Overloading fill color (polygon or text) with CanvasPattern and CanvasGradient ([@bjnsn](https://github.com/bjnsn))
|
||||
* [#4842](https://github.com/openlayers/ol3/pull/4842) - Remove use of goog.dom.createDom ([@fredj](https://github.com/fredj))
|
||||
* [#4808](https://github.com/openlayers/ol3/pull/4808) - Type cleanup ([@fredj](https://github.com/fredj))
|
||||
* [#4737](https://github.com/openlayers/ol3/pull/4737) - Use olx.format.ReadOptions in ol.interaction.DragAndDrop ([@fredj](https://github.com/fredj))
|
||||
* [#4830](https://github.com/openlayers/ol3/pull/4830) - Make sure window.proj4 is always restored in tests ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4838](https://github.com/openlayers/ol3/pull/4838) - Use regular expression instead of String#endsWith() check ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4837](https://github.com/openlayers/ol3/pull/4837) - Update metalsmith-layouts to version 1.5.4 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4836](https://github.com/openlayers/ol3/pull/4836) - Use lowercase for all user agent checks ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4833](https://github.com/openlayers/ol3/pull/4833) - Upgrade linter and config. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4831](https://github.com/openlayers/ol3/pull/4831) - Add navigation header to examples page ([@jonataswalker](https://github.com/jonataswalker))
|
||||
* [#4824](https://github.com/openlayers/ol3/pull/4824) - Don't use goog.string.newlines.* ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4825](https://github.com/openlayers/ol3/pull/4825) - Don't use goog.string.isEmpty ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4823](https://github.com/openlayers/ol3/pull/4823) - Fix type for layers option on ol.interaction.Select ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4815](https://github.com/openlayers/ol3/pull/4815) - wrapX false in synthetic examples ([@fredj](https://github.com/fredj))
|
||||
* [#4810](https://github.com/openlayers/ol3/pull/4810) - Add checks for undefined in controls ([@gberaudo](https://github.com/gberaudo))
|
||||
* [#4787](https://github.com/openlayers/ol3/pull/4787) - Add precision parameter for HDMS coordinate ([@pfanguin](https://github.com/pfanguin))
|
||||
* [#4811](https://github.com/openlayers/ol3/pull/4811) - Make ol.style.Style a @struct ([@fredj](https://github.com/fredj))
|
||||
* [#4800](https://github.com/openlayers/ol3/pull/4800) - Update phantomjs-prebuilt to version 2.1.4 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4792](https://github.com/openlayers/ol3/pull/4792) - Use ol.events.listen instead of ol.Observable#on ([@fredj](https://github.com/fredj))
|
||||
* [#4796](https://github.com/openlayers/ol3/pull/4796) - Remove use of goog.isString() ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4795](https://github.com/openlayers/ol3/pull/4795) - Cleanup after goog.array, goog.object and goog.isDef removal ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4791](https://github.com/openlayers/ol3/pull/4791) - Remove unnecessary cast ([@fredj](https://github.com/fredj))
|
||||
* [#4778](https://github.com/openlayers/ol3/pull/4778) - Remove use of goog.object. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4789](https://github.com/openlayers/ol3/pull/4789) - Use ol.array instead of goog.array ([@fredj](https://github.com/fredj))
|
||||
* [#4788](https://github.com/openlayers/ol3/pull/4788) - Remove unnecessary newlines ([@fredj](https://github.com/fredj))
|
||||
* [#4731](https://github.com/openlayers/ol3/pull/4731) - Remove all remaining unnecessary casts ([@gberaudo](https://github.com/gberaudo))
|
||||
* [#4776](https://github.com/openlayers/ol3/pull/4776) - Correct assertion message in ol.array.binarySearch-test ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4711](https://github.com/openlayers/ol3/pull/4711) - Removal of goog.events.* ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4777](https://github.com/openlayers/ol3/pull/4777) - Fix source.UrlTile URL expansion ([@gberaudo](https://github.com/gberaudo))
|
||||
* [#4730](https://github.com/openlayers/ol3/pull/4730) - Document ol.Geolocation error event ([@fredj](https://github.com/fredj))
|
||||
* [#4772](https://github.com/openlayers/ol3/pull/4772) - Use node.setAttribute to set namespaceURI of a node ([@adube](https://github.com/adube))
|
||||
* [#4774](https://github.com/openlayers/ol3/pull/4774) - Update graceful-fs to version 4.1.3 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4680](https://github.com/openlayers/ol3/pull/4680) - Remove goog array. ([@nicholas-l](https://github.com/nicholas-l))
|
||||
* [#4771](https://github.com/openlayers/ol3/pull/4771) - Use innerHTML instead of innerText to populate the status element ([@fredj](https://github.com/fredj))
|
||||
* [#4769](https://github.com/openlayers/ol3/pull/4769) - Add opaque option to olx.source.OSMOptions ([@fredj](https://github.com/fredj))
|
||||
* [#4736](https://github.com/openlayers/ol3/pull/4736) - Properly detect feature on unmanaged layer for toggle selection ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4756](https://github.com/openlayers/ol3/pull/4756) - Remove VectorTile getSource re-definition of return value ([@adube](https://github.com/adube))
|
||||
* [#4733](https://github.com/openlayers/ol3/pull/4733) - Avoid rendering too big and too small images for vector tiles ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4754](https://github.com/openlayers/ol3/pull/4754) - Upgrade to mocha@2.4.5. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4750](https://github.com/openlayers/ol3/pull/4750) - Update metalsmith-layouts to version 1.4.4 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4751](https://github.com/openlayers/ol3/pull/4751) - Update phantomjs to version 2.1.3 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4741](https://github.com/openlayers/ol3/pull/4741) - Report on installed versions in Travis. ([@openlayers](https://github.com/openlayers))
|
||||
* [#4742](https://github.com/openlayers/ol3/pull/4742) - Upgrade to eslint@2.0.0-beta.2. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4746](https://github.com/openlayers/ol3/pull/4746) - Downgrade to mocha@2.3.4. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4740](https://github.com/openlayers/ol3/pull/4740) - Update fs-extra to version 0.26.5 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4738](https://github.com/openlayers/ol3/pull/4738) - Add unit tests for ol.control.Rotate and ol.control.Zoom ([@fredj](https://github.com/fredj))
|
||||
* [#4718](https://github.com/openlayers/ol3/pull/4718) - Improve raster reprojection behavior when tiles fail to load ([@klokantech](https://github.com/klokantech))
|
||||
* [#4734](https://github.com/openlayers/ol3/pull/4734) - Update sinon to version 1.17.3 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4726](https://github.com/openlayers/ol3/pull/4726) - Update mocha to version 2.4.2 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4725](https://github.com/openlayers/ol3/pull/4725) - Untangle vector tile feature reprojection ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4735](https://github.com/openlayers/ol3/pull/4735) - Add default value for defaultDataProjection ([@fredj](https://github.com/fredj))
|
||||
* [#4732](https://github.com/openlayers/ol3/pull/4732) - Fix '@see' link in src/ol/deviceorientation.js ([@fredj](https://github.com/fredj))
|
||||
* [#4720](https://github.com/openlayers/ol3/pull/4720) - Improve tileLoadFunction docs ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4717](https://github.com/openlayers/ol3/pull/4717) - Update phantomjs to version 2.1.2 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4679](https://github.com/openlayers/ol3/pull/4679) - Add a source option for the full screen control ([@gaf-ag](https://github.com/gaf-ag))
|
||||
* [#4712](https://github.com/openlayers/ol3/pull/4712) - Add missing JSDoc tags ([@fredj](https://github.com/fredj))
|
||||
* [#4700](https://github.com/openlayers/ol3/pull/4700) - Add 'layers' option for WMSGetFeatureInfo format ([@adube](https://github.com/adube))
|
||||
* [#4705](https://github.com/openlayers/ol3/pull/4705) - Remove remaining unnecessary ol.source.State casts ([@gberaudo](https://github.com/gberaudo))
|
||||
* [#4703](https://github.com/openlayers/ol3/pull/4703) - Source options fixes. ([@gberaudo](https://github.com/gberaudo))
|
||||
* [#4698](https://github.com/openlayers/ol3/pull/4698) - Add rotateWithView option to ol.style.RegularShape ([@fredj](https://github.com/fredj))
|
||||
* [#4697](https://github.com/openlayers/ol3/pull/4697) - Bind tileUrlFunction to the source ([@gberaudo](https://github.com/gberaudo))
|
||||
@@ -24,7 +24,6 @@
|
||||
"externs/topojson.js"
|
||||
],
|
||||
"define": [
|
||||
"goog.array.ASSUME_NATIVE_FUNCTIONS=true",
|
||||
"goog.dom.ASSUME_STANDARDS_MODE=true",
|
||||
"goog.json.USE_NATIVE_JSON=true",
|
||||
"goog.DEBUG=false"
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
"externs/example.js",
|
||||
"externs/fastclick.js",
|
||||
"externs/geojson.js",
|
||||
"externs/jspdf.js",
|
||||
"externs/jquery-1.9.js",
|
||||
"externs/proj4js.js",
|
||||
"externs/tilejson.js",
|
||||
"externs/topojson.js"
|
||||
],
|
||||
"define": [
|
||||
"goog.array.ASSUME_NATIVE_FUNCTIONS=true",
|
||||
"goog.dom.ASSUME_STANDARDS_MODE=true",
|
||||
"goog.json.USE_NATIVE_JSON=true",
|
||||
"goog.DEBUG=false"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<link rel="stylesheet" href="./resources/layout.css" type="text/css">
|
||||
{{{ extraHead.local }}}
|
||||
{{{ css.tag }}}
|
||||
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch"></script>
|
||||
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch,requestAnimationFrame"></script>
|
||||
<script src="./resources/zeroclipboard/ZeroClipboard.min.js"></script>
|
||||
<title>{{ title }}</title>
|
||||
</head>
|
||||
@@ -20,6 +20,12 @@
|
||||
<header class="navbar" role="navigation">
|
||||
<div class="container" id="navbar-inner-container">
|
||||
<a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png"> OpenLayers 3 Examples</a>
|
||||
<ul class="nav navbar-nav pull-right">
|
||||
<li><a href="../doc">Docs</a></li>
|
||||
<li><a class="active" href="index.html">Examples</a></li>
|
||||
<li><a href="../apidoc">API</a></li>
|
||||
<li><a href="https://github.com/openlayers/ol3">Code</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<td><p>Layers are lightweight containers that get their data from [sources](ol.source.html).</p>
|
||||
[ol.layer.Tile](ol.layer.Tile.html)<br>
|
||||
[ol.layer.Image](ol.layer.Image.html)<br>
|
||||
[ol.layer.Vector](ol.layer.Vector.html)</td>
|
||||
[ol.layer.Vector](ol.layer.Vector.html)<br>
|
||||
[ol.layer.VectorTile](ol.layer.VectorTile.html)</td>
|
||||
</tr><tr>
|
||||
<th>Controls</th><th>Interactions</th><th>Sources and formats</th>
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
"externs/topojson.js"
|
||||
],
|
||||
"define": [
|
||||
"goog.array.ASSUME_NATIVE_FUNCTIONS=true",
|
||||
"goog.dom.ASSUME_STANDARDS_MODE=true",
|
||||
"goog.json.USE_NATIVE_JSON=true",
|
||||
"goog.DEBUG=false"
|
||||
@@ -24,9 +23,14 @@
|
||||
],
|
||||
"jscomp_off": [
|
||||
"useOfGoogBase",
|
||||
"unnecessaryCasts",
|
||||
"lintChecks"
|
||||
],
|
||||
"hide_warnings_for": [
|
||||
"node_modules/closure-util"
|
||||
],
|
||||
"jscomp_warning": [
|
||||
"unnecessaryCasts"
|
||||
],
|
||||
"extra_annotation_name": [
|
||||
"api", "observable"
|
||||
],
|
||||
|
||||
@@ -167,7 +167,6 @@ The minimum config file looks like this:
|
||||
"node_modules/openlayers/externs/topojson.js"
|
||||
],
|
||||
"define": [
|
||||
"goog.array.ASSUME_NATIVE_FUNCTIONS=true",
|
||||
"goog.dom.ASSUME_STANDARDS_MODE=true",
|
||||
"goog.json.USE_NATIVE_JSON=true",
|
||||
"goog.DEBUG=false",
|
||||
@@ -223,7 +222,6 @@ Here is a version of `config.json` with more compilation checks enabled:
|
||||
"node_modules/openlayers/externs/topojson.js"
|
||||
],
|
||||
"define": [
|
||||
"goog.array.ASSUME_NATIVE_FUNCTIONS=true",
|
||||
"goog.dom.ASSUME_STANDARDS_MODE=true",
|
||||
"goog.json.USE_NATIVE_JSON=true",
|
||||
"goog.DEBUG=false",
|
||||
|
||||
@@ -60,7 +60,6 @@ Creating a custom build requires writing a build configuration file. The format
|
||||
"externs/topojson.js"
|
||||
],
|
||||
"define": [
|
||||
"goog.array.ASSUME_NATIVE_FUNCTIONS=true",
|
||||
"goog.dom.ASSUME_STANDARDS_MODE=true",
|
||||
"goog.json.USE_NATIVE_JSON=true",
|
||||
"goog.DEBUG=false"
|
||||
|
||||
17
examples/.eslintrc
Normal file
17
examples/.eslintrc
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"globals": {
|
||||
"FastClick": false,
|
||||
"$": false,
|
||||
"arc": false,
|
||||
"common": false,
|
||||
"createMapboxStreetsV6Style": false,
|
||||
"d3": false,
|
||||
"jsPDF": false,
|
||||
"jsts": false,
|
||||
"topojson": false,
|
||||
"turf": false
|
||||
},
|
||||
"rules": {
|
||||
"no-unused-vars": [2, {"varsIgnorePattern": "^map"}]
|
||||
}
|
||||
}
|
||||
@@ -14,3 +14,6 @@ a.skiplink:focus {
|
||||
background-color: #fff;
|
||||
padding: 0.3em;
|
||||
}
|
||||
#map:focus {
|
||||
outline: #4A74A8 solid 0.15em;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ var map = new ol.Map({
|
||||
source: new ol.source.OSM()
|
||||
})
|
||||
],
|
||||
controls: ol.control.defaults({ attribution: false }).extend([attribution]),
|
||||
controls: ol.control.defaults({attribution: false}).extend([attribution]),
|
||||
renderer: common.getRendererFromQueryString(),
|
||||
target: 'map',
|
||||
view: new ol.View({
|
||||
|
||||
@@ -6,7 +6,7 @@ docs: >
|
||||
<p>When the Bing Maps tile service doesn't have tiles for a given resolution and region it returns "placeholder" tiles indicating that. Zoom the map beyond level 19 to see the "placeholder" tiles. If you want OpenLayers to display stretched tiles in place of "placeholder" tiles beyond zoom level 19 then set <code>maxZoom</code> to <code>19</code> in the options passed to <code>ol.source.BingMaps</code>.</p>
|
||||
tags: "bing, bing-maps"
|
||||
cloak:
|
||||
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
---
|
||||
<div id="map" class="map"></div>
|
||||
<select id="layer-select">
|
||||
|
||||
@@ -18,7 +18,7 @@ for (i = 0, ii = styles.length; i < ii; ++i) {
|
||||
visible: false,
|
||||
preload: Infinity,
|
||||
source: new ol.source.BingMaps({
|
||||
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3',
|
||||
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
|
||||
imagerySet: styles[i]
|
||||
// use maxZoom 19 to see stretched tiles instead of the BingMaps
|
||||
// "no photos at this zoom level" tiles
|
||||
|
||||
@@ -85,8 +85,13 @@ var map = new ol.Map({
|
||||
})
|
||||
});
|
||||
|
||||
// Get the form elements and bind the listeners
|
||||
var select = document.getElementById('blend-mode');
|
||||
var affectRed = document.getElementById('affect-red');
|
||||
var affectGreen = document.getElementById('affect-green');
|
||||
var affectBlue = document.getElementById('affect-blue');
|
||||
|
||||
|
||||
// Various helper methods and event handlers
|
||||
/**
|
||||
* This method sets the globalCompositeOperation to the value of the select
|
||||
* field and it is bound to the precompose event of the layers.
|
||||
@@ -154,12 +159,6 @@ var affectLayerClicked = function() {
|
||||
};
|
||||
|
||||
|
||||
// Get the form elements and bind the listeners
|
||||
var select = document.getElementById('blend-mode');
|
||||
var affectRed = document.getElementById('affect-red');
|
||||
var affectGreen = document.getElementById('affect-green');
|
||||
var affectBlue = document.getElementById('affect-blue');
|
||||
|
||||
// Rerender map when blend mode changes
|
||||
select.addEventListener('change', function() {
|
||||
map.render();
|
||||
|
||||
@@ -48,7 +48,7 @@ map.addInteraction(dragBox);
|
||||
|
||||
var infoBox = document.getElementById('info');
|
||||
|
||||
dragBox.on('boxend', function(e) {
|
||||
dragBox.on('boxend', function() {
|
||||
// features that intersect the box are added to the collection of
|
||||
// selected features, and their names are displayed in the "info"
|
||||
// div
|
||||
@@ -64,7 +64,7 @@ dragBox.on('boxend', function(e) {
|
||||
});
|
||||
|
||||
// clear selection when drawing a new box and when clicking on the map
|
||||
dragBox.on('boxstart', function(e) {
|
||||
dragBox.on('boxstart', function() {
|
||||
selectedFeatures.clear();
|
||||
infoBox.innerHTML = ' ';
|
||||
});
|
||||
|
||||
@@ -65,14 +65,7 @@ zoomtoswitzerlandbest.addEventListener('click', function() {
|
||||
var feature = source.getFeatures()[0];
|
||||
var polygon = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry());
|
||||
var size = /** @type {ol.Size} */ (map.getSize());
|
||||
view.fit(
|
||||
polygon,
|
||||
size,
|
||||
{
|
||||
padding: [170, 50, 30, 150],
|
||||
constrainResolution: false
|
||||
}
|
||||
);
|
||||
view.fit(polygon, size, {padding: [170, 50, 30, 150], constrainResolution: false});
|
||||
}, false);
|
||||
|
||||
var zoomtoswitzerlandconstrained =
|
||||
@@ -81,13 +74,7 @@ zoomtoswitzerlandconstrained.addEventListener('click', function() {
|
||||
var feature = source.getFeatures()[0];
|
||||
var polygon = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry());
|
||||
var size = /** @type {ol.Size} */ (map.getSize());
|
||||
view.fit(
|
||||
polygon,
|
||||
size,
|
||||
{
|
||||
padding: [170, 50, 30, 150]
|
||||
}
|
||||
);
|
||||
view.fit(polygon, size, {padding: [170, 50, 30, 150]});
|
||||
}, false);
|
||||
|
||||
var zoomtoswitzerlandnearest =
|
||||
@@ -96,14 +83,7 @@ zoomtoswitzerlandnearest.addEventListener('click', function() {
|
||||
var feature = source.getFeatures()[0];
|
||||
var polygon = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry());
|
||||
var size = /** @type {ol.Size} */ (map.getSize());
|
||||
view.fit(
|
||||
polygon,
|
||||
size,
|
||||
{
|
||||
padding: [170, 50, 30, 150],
|
||||
nearest: true
|
||||
}
|
||||
);
|
||||
view.fit(polygon, size, {padding: [170, 50, 30, 150], nearest: true});
|
||||
}, false);
|
||||
|
||||
var zoomtolausanne = document.getElementById('zoomtolausanne');
|
||||
@@ -111,14 +91,7 @@ zoomtolausanne.addEventListener('click', function() {
|
||||
var feature = source.getFeatures()[1];
|
||||
var point = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry());
|
||||
var size = /** @type {ol.Size} */ (map.getSize());
|
||||
view.fit(
|
||||
point,
|
||||
size,
|
||||
{
|
||||
padding: [170, 50, 30, 150],
|
||||
minResolution: 50
|
||||
}
|
||||
);
|
||||
view.fit(point, size, {padding: [170, 50, 30, 150], minResolution: 50});
|
||||
}, false);
|
||||
|
||||
var centerlausanne = document.getElementById('centerlausanne');
|
||||
@@ -126,9 +99,5 @@ centerlausanne.addEventListener('click', function() {
|
||||
var feature = source.getFeatures()[1];
|
||||
var point = /** @type {ol.geom.Point} */ (feature.getGeometry());
|
||||
var size = /** @type {ol.Size} */ (map.getSize());
|
||||
view.centerOn(
|
||||
point.getCoordinates(),
|
||||
size,
|
||||
[570, 500]
|
||||
);
|
||||
view.centerOn(point.getCoordinates(), size, [570, 500]);
|
||||
}, false);
|
||||
|
||||
@@ -34,7 +34,7 @@ var clusterSource = new ol.source.Cluster({
|
||||
var styleCache = {};
|
||||
var clusters = new ol.layer.Vector({
|
||||
source: clusterSource,
|
||||
style: function(feature, resolution) {
|
||||
style: function(feature) {
|
||||
var size = feature.get('features').length;
|
||||
var style = styleCache[size];
|
||||
if (!style) {
|
||||
@@ -65,10 +65,6 @@ var raster = new ol.layer.Tile({
|
||||
source: new ol.source.MapQuest({layer: 'sat'})
|
||||
});
|
||||
|
||||
var raw = new ol.layer.Vector({
|
||||
source: source
|
||||
});
|
||||
|
||||
var map = new ol.Map({
|
||||
layers: [raster, clusters],
|
||||
renderer: 'canvas',
|
||||
|
||||
@@ -138,6 +138,8 @@ var raster = new ol.source.Raster({
|
||||
}
|
||||
});
|
||||
|
||||
var controls = {};
|
||||
|
||||
raster.on('beforeoperations', function(event) {
|
||||
var data = event.data;
|
||||
for (var id in controls) {
|
||||
@@ -160,7 +162,6 @@ var map = new ol.Map({
|
||||
});
|
||||
|
||||
var controlIds = ['hue', 'chroma', 'lightness'];
|
||||
var controls = {};
|
||||
controlIds.forEach(function(id) {
|
||||
var control = document.getElementById(id);
|
||||
var output = document.getElementById(id + 'Out');
|
||||
|
||||
@@ -19,7 +19,6 @@ var app = window.app;
|
||||
//
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.control.Control}
|
||||
@@ -33,7 +32,7 @@ app.RotateNorthControl = function(opt_options) {
|
||||
button.innerHTML = 'N';
|
||||
|
||||
var this_ = this;
|
||||
var handleRotateNorth = function(e) {
|
||||
var handleRotateNorth = function() {
|
||||
this_.getMap().getView().setRotation(0);
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ goog.require('ol.style.Style');
|
||||
var app = {};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.interaction.Pointer}
|
||||
@@ -72,7 +71,7 @@ app.Drag.prototype.handleDownEvent = function(evt) {
|
||||
var map = evt.map;
|
||||
|
||||
var feature = map.forEachFeatureAtPixel(evt.pixel,
|
||||
function(feature, layer) {
|
||||
function(feature) {
|
||||
return feature;
|
||||
});
|
||||
|
||||
@@ -89,13 +88,6 @@ app.Drag.prototype.handleDownEvent = function(evt) {
|
||||
* @param {ol.MapBrowserEvent} evt Map browser event.
|
||||
*/
|
||||
app.Drag.prototype.handleDragEvent = function(evt) {
|
||||
var map = evt.map;
|
||||
|
||||
var feature = map.forEachFeatureAtPixel(evt.pixel,
|
||||
function(feature, layer) {
|
||||
return feature;
|
||||
});
|
||||
|
||||
var deltaX = evt.coordinate[0] - this.coordinate_[0];
|
||||
var deltaY = evt.coordinate[1] - this.coordinate_[1];
|
||||
|
||||
@@ -115,7 +107,7 @@ app.Drag.prototype.handleMoveEvent = function(evt) {
|
||||
if (this.cursor_) {
|
||||
var map = evt.map;
|
||||
var feature = map.forEachFeatureAtPixel(evt.pixel,
|
||||
function(feature, layer) {
|
||||
function(feature) {
|
||||
return feature;
|
||||
});
|
||||
var element = evt.map.getTargetElement();
|
||||
@@ -133,10 +125,9 @@ app.Drag.prototype.handleMoveEvent = function(evt) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.MapBrowserEvent} evt Map browser event.
|
||||
* @return {boolean} `false` to stop the drag sequence.
|
||||
*/
|
||||
app.Drag.prototype.handleUpEvent = function(evt) {
|
||||
app.Drag.prototype.handleUpEvent = function() {
|
||||
this.coordinate_ = null;
|
||||
this.feature_ = null;
|
||||
return false;
|
||||
@@ -158,7 +149,7 @@ var map = new ol.Map({
|
||||
layers: [
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.TileJSON({
|
||||
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.jsonp'
|
||||
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.json'
|
||||
})
|
||||
}),
|
||||
new ol.layer.Vector({
|
||||
|
||||
2
examples/d3.js
vendored
2
examples/d3.js
vendored
@@ -39,7 +39,7 @@ d3.json('data/topojson/us.json', function(error, us) {
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {ol.Size} size Size.
|
||||
* @param {ol.proj.Projection} projection Projection.
|
||||
* @return {HTMLCanvasElement}
|
||||
* @return {HTMLCanvasElement} A canvas element.
|
||||
*/
|
||||
var canvasFunction = function(extent, resolution, pixelRatio,
|
||||
size, projection) {
|
||||
|
||||
BIN
examples/data/dot.png
Normal file
BIN
examples/data/dot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 478 B |
283
examples/data/wmsgetfeatureinfo/osm-restaurant-hotel.xml
Normal file
283
examples/data/wmsgetfeatureinfo/osm-restaurant-hotel.xml
Normal file
@@ -0,0 +1,283 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<msGMLOutput
|
||||
xmlns:gml="http://www.opengis.net/gml"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<restaurant_layer>
|
||||
<gml:name>Restaurants</gml:name>
|
||||
<restaurant_feature>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:21781">
|
||||
<gml:coordinates>537750.006175,150923.784252 537750.006175,150923.784252</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<THE_GEOM>
|
||||
<gml:Point srsName="EPSG:21781">
|
||||
<gml:coordinates>537750.006175,150923.784252</gml:coordinates>
|
||||
</gml:Point>
|
||||
</THE_GEOM>
|
||||
<display_name>Château d'Ouchy</display_name>
|
||||
<name>Château d'Ouchy</name>
|
||||
<osm_id>1230808910</osm_id>
|
||||
<access></access>
|
||||
<aerialway></aerialway>
|
||||
<amenity>restaurant</amenity>
|
||||
<barrier></barrier>
|
||||
<bicycle></bicycle>
|
||||
<brand></brand>
|
||||
<building></building>
|
||||
<covered></covered>
|
||||
<denomination></denomination>
|
||||
<ele></ele>
|
||||
<foot></foot>
|
||||
<highway></highway>
|
||||
<layer></layer>
|
||||
<leisure></leisure>
|
||||
<man_made></man_made>
|
||||
<motorcar></motorcar>
|
||||
<natural></natural>
|
||||
<operator></operator>
|
||||
<population></population>
|
||||
<power></power>
|
||||
<place></place>
|
||||
<railway></railway>
|
||||
<ref></ref>
|
||||
<religion></religion>
|
||||
<shop></shop>
|
||||
<sport></sport>
|
||||
<surface></surface>
|
||||
<tourism></tourism>
|
||||
<waterway></waterway>
|
||||
<wood></wood>
|
||||
</restaurant_feature>
|
||||
<restaurant_feature>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:21781">
|
||||
<gml:coordinates>537770.247124,150975.613968 537770.247124,150975.613968</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<THE_GEOM>
|
||||
<gml:Point srsName="EPSG:21781">
|
||||
<gml:coordinates>537770.247124,150975.613968</gml:coordinates>
|
||||
</gml:Point>
|
||||
</THE_GEOM>
|
||||
<display_name>Cafe du Vieil Ouchy</display_name>
|
||||
<name>Cafe du Vieil Ouchy</name>
|
||||
<osm_id>1433812389</osm_id>
|
||||
<access></access>
|
||||
<aerialway></aerialway>
|
||||
<amenity>restaurant</amenity>
|
||||
<barrier></barrier>
|
||||
<bicycle></bicycle>
|
||||
<brand></brand>
|
||||
<building></building>
|
||||
<covered></covered>
|
||||
<denomination></denomination>
|
||||
<ele></ele>
|
||||
<foot></foot>
|
||||
<highway></highway>
|
||||
<layer></layer>
|
||||
<leisure></leisure>
|
||||
<man_made></man_made>
|
||||
<motorcar></motorcar>
|
||||
<natural></natural>
|
||||
<operator>Carine Duca</operator>
|
||||
<population></population>
|
||||
<power></power>
|
||||
<place></place>
|
||||
<railway></railway>
|
||||
<ref></ref>
|
||||
<religion></religion>
|
||||
<shop></shop>
|
||||
<sport></sport>
|
||||
<surface></surface>
|
||||
<tourism></tourism>
|
||||
<waterway></waterway>
|
||||
<wood></wood>
|
||||
</restaurant_feature>
|
||||
<restaurant_feature>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:21781">
|
||||
<gml:coordinates>537789.197617,150976.218227 537789.197617,150976.218227</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<THE_GEOM>
|
||||
<gml:Point srsName="EPSG:21781">
|
||||
<gml:coordinates>537789.197617,150976.218227</gml:coordinates>
|
||||
</gml:Point>
|
||||
</THE_GEOM>
|
||||
<display_name>Creperie</display_name>
|
||||
<name>Creperie</name>
|
||||
<osm_id>1433812391</osm_id>
|
||||
<access></access>
|
||||
<aerialway></aerialway>
|
||||
<amenity>restaurant</amenity>
|
||||
<barrier></barrier>
|
||||
<bicycle></bicycle>
|
||||
<brand></brand>
|
||||
<building></building>
|
||||
<covered></covered>
|
||||
<denomination></denomination>
|
||||
<ele></ele>
|
||||
<foot></foot>
|
||||
<highway></highway>
|
||||
<layer></layer>
|
||||
<leisure></leisure>
|
||||
<man_made></man_made>
|
||||
<motorcar></motorcar>
|
||||
<natural></natural>
|
||||
<operator></operator>
|
||||
<population></population>
|
||||
<power></power>
|
||||
<place></place>
|
||||
<railway></railway>
|
||||
<ref></ref>
|
||||
<religion></religion>
|
||||
<shop></shop>
|
||||
<sport></sport>
|
||||
<surface></surface>
|
||||
<tourism></tourism>
|
||||
<waterway></waterway>
|
||||
<wood></wood>
|
||||
</restaurant_feature>
|
||||
<restaurant_feature>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:21781">
|
||||
<gml:coordinates>537810.679909,150983.377694 537810.679909,150983.377694</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<THE_GEOM>
|
||||
<gml:Point srsName="EPSG:21781">
|
||||
<gml:coordinates>537810.679909,150983.377694</gml:coordinates>
|
||||
</gml:Point>
|
||||
</THE_GEOM>
|
||||
<display_name>1433812390</display_name>
|
||||
<name></name>
|
||||
<osm_id>1433812390</osm_id>
|
||||
<access></access>
|
||||
<aerialway></aerialway>
|
||||
<amenity>restaurant</amenity>
|
||||
<barrier></barrier>
|
||||
<bicycle></bicycle>
|
||||
<brand></brand>
|
||||
<building></building>
|
||||
<covered></covered>
|
||||
<denomination></denomination>
|
||||
<ele></ele>
|
||||
<foot></foot>
|
||||
<highway></highway>
|
||||
<layer></layer>
|
||||
<leisure></leisure>
|
||||
<man_made></man_made>
|
||||
<motorcar></motorcar>
|
||||
<natural></natural>
|
||||
<operator></operator>
|
||||
<population></population>
|
||||
<power></power>
|
||||
<place></place>
|
||||
<railway></railway>
|
||||
<ref></ref>
|
||||
<religion></religion>
|
||||
<shop></shop>
|
||||
<sport></sport>
|
||||
<surface></surface>
|
||||
<tourism></tourism>
|
||||
<waterway></waterway>
|
||||
<wood></wood>
|
||||
</restaurant_feature>
|
||||
</restaurant_layer>
|
||||
<hotel_layer>
|
||||
<gml:name>Hôtels</gml:name>
|
||||
<hotel_feature>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:21781">
|
||||
<gml:coordinates>537762.425297,150971.904013 537762.425297,150971.904013</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<THE_GEOM>
|
||||
<gml:Point srsName="EPSG:21781">
|
||||
<gml:coordinates>537762.425297,150971.904013</gml:coordinates>
|
||||
</gml:Point>
|
||||
</THE_GEOM>
|
||||
<display_name>Hotel du port</display_name>
|
||||
<name>Hotel du port</name>
|
||||
<osm_id>2886793101</osm_id>
|
||||
<access></access>
|
||||
<aerialway></aerialway>
|
||||
<amenity></amenity>
|
||||
<barrier></barrier>
|
||||
<bicycle></bicycle>
|
||||
<brand></brand>
|
||||
<building></building>
|
||||
<covered></covered>
|
||||
<denomination></denomination>
|
||||
<ele></ele>
|
||||
<foot></foot>
|
||||
<highway></highway>
|
||||
<layer></layer>
|
||||
<leisure></leisure>
|
||||
<man_made></man_made>
|
||||
<motorcar></motorcar>
|
||||
<natural></natural>
|
||||
<operator></operator>
|
||||
<population></population>
|
||||
<power></power>
|
||||
<place></place>
|
||||
<railway></railway>
|
||||
<ref></ref>
|
||||
<religion></religion>
|
||||
<shop></shop>
|
||||
<sport></sport>
|
||||
<surface></surface>
|
||||
<tourism>hotel</tourism>
|
||||
<waterway></waterway>
|
||||
<wood></wood>
|
||||
</hotel_feature>
|
||||
<hotel_feature>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:21781">
|
||||
<gml:coordinates>537798.352160,150985.584164 537798.352160,150985.584164</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<THE_GEOM>
|
||||
<gml:Point srsName="EPSG:21781">
|
||||
<gml:coordinates>537798.352160,150985.584164</gml:coordinates>
|
||||
</gml:Point>
|
||||
</THE_GEOM>
|
||||
<display_name>Angleterre</display_name>
|
||||
<name>Angleterre</name>
|
||||
<osm_id>1433812387</osm_id>
|
||||
<access></access>
|
||||
<aerialway></aerialway>
|
||||
<amenity></amenity>
|
||||
<barrier></barrier>
|
||||
<bicycle></bicycle>
|
||||
<brand></brand>
|
||||
<building></building>
|
||||
<covered></covered>
|
||||
<denomination></denomination>
|
||||
<ele></ele>
|
||||
<foot></foot>
|
||||
<highway></highway>
|
||||
<layer></layer>
|
||||
<leisure></leisure>
|
||||
<man_made></man_made>
|
||||
<motorcar></motorcar>
|
||||
<natural></natural>
|
||||
<operator></operator>
|
||||
<population></population>
|
||||
<power></power>
|
||||
<place></place>
|
||||
<railway></railway>
|
||||
<ref></ref>
|
||||
<religion></religion>
|
||||
<shop></shop>
|
||||
<sport></sport>
|
||||
<surface></surface>
|
||||
<tourism>hotel</tourism>
|
||||
<waterway></waterway>
|
||||
<wood></wood>
|
||||
</hotel_feature>
|
||||
</hotel_layer>
|
||||
</msGMLOutput>
|
||||
@@ -39,7 +39,7 @@ el('track').addEventListener('change', function() {
|
||||
deviceOrientation.setTracking(this.checked);
|
||||
});
|
||||
|
||||
deviceOrientation.on('change', function(event) {
|
||||
deviceOrientation.on('change', function() {
|
||||
el('alpha').innerText = deviceOrientation.getAlpha() + ' [rad]';
|
||||
el('beta').innerText = deviceOrientation.getBeta() + ' [rad]';
|
||||
el('gamma').innerText = deviceOrientation.getGamma() + ' [rad]';
|
||||
|
||||
@@ -6,7 +6,7 @@ docs: >
|
||||
Example of using the drag-and-drop interaction with a ol.source.ImageVector. Drag and drop GPX, GeoJSON, IGC, KML, or TopoJSON files on to the map. Each file is rendered to an image on the client.
|
||||
tags: "drag-and-drop-image-vector, gpx, geojson, igc, kml, topojson, vector, image"
|
||||
cloak:
|
||||
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
---
|
||||
<div id="map" class="map"></div>
|
||||
<div id="info"> </div>
|
||||
|
||||
@@ -100,7 +100,7 @@ var map = new ol.Map({
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.BingMaps({
|
||||
imagerySet: 'Aerial',
|
||||
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3'
|
||||
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF'
|
||||
})
|
||||
})
|
||||
],
|
||||
@@ -128,7 +128,7 @@ dragAndDropInteraction.on('addfeatures', function(event) {
|
||||
|
||||
var displayFeatureInfo = function(pixel) {
|
||||
var features = [];
|
||||
map.forEachFeatureAtPixel(pixel, function(feature, layer) {
|
||||
map.forEachFeatureAtPixel(pixel, function(feature) {
|
||||
features.push(feature);
|
||||
});
|
||||
if (features.length > 0) {
|
||||
|
||||
@@ -6,7 +6,7 @@ docs: >
|
||||
Example of using the drag-and-drop interaction. Drag and drop GPX, GeoJSON, IGC, KML, or TopoJSON files on to the map. There is no projection transform support, so this will only work with data in EPSG:4326 and EPSG:3857.
|
||||
tags: "drag-and-drop, gpx, geojson, igc, kml, topojson"
|
||||
cloak:
|
||||
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
---
|
||||
<div id="map" class="map"></div>
|
||||
<div id="info"> </div>
|
||||
|
||||
@@ -99,7 +99,7 @@ var map = new ol.Map({
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.BingMaps({
|
||||
imagerySet: 'Aerial',
|
||||
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3'
|
||||
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF'
|
||||
})
|
||||
})
|
||||
],
|
||||
@@ -124,7 +124,7 @@ dragAndDropInteraction.on('addfeatures', function(event) {
|
||||
|
||||
var displayFeatureInfo = function(pixel) {
|
||||
var features = [];
|
||||
map.forEachFeatureAtPixel(pixel, function(feature, layer) {
|
||||
map.forEachFeatureAtPixel(pixel, function(feature) {
|
||||
features.push(feature);
|
||||
});
|
||||
if (features.length > 0) {
|
||||
|
||||
@@ -60,6 +60,8 @@ var modify = new ol.interaction.Modify({
|
||||
map.addInteraction(modify);
|
||||
|
||||
var draw; // global so we can remove it later
|
||||
var typeSelect = document.getElementById('type');
|
||||
|
||||
function addInteraction() {
|
||||
draw = new ol.interaction.Draw({
|
||||
features: features,
|
||||
@@ -68,14 +70,11 @@ function addInteraction() {
|
||||
map.addInteraction(draw);
|
||||
}
|
||||
|
||||
var typeSelect = document.getElementById('type');
|
||||
|
||||
|
||||
/**
|
||||
* Let user change the geometry type.
|
||||
* @param {Event} e Change event.
|
||||
* Handle change event.
|
||||
*/
|
||||
typeSelect.onchange = function(e) {
|
||||
typeSelect.onchange = function() {
|
||||
map.removeInteraction(draw);
|
||||
addInteraction();
|
||||
};
|
||||
|
||||
@@ -83,10 +83,9 @@ function addInteraction() {
|
||||
|
||||
|
||||
/**
|
||||
* Let user change the geometry type.
|
||||
* @param {Event} e Change event.
|
||||
* Handle change event.
|
||||
*/
|
||||
typeSelect.onchange = function(e) {
|
||||
typeSelect.onchange = function() {
|
||||
map.removeInteraction(draw);
|
||||
addInteraction();
|
||||
};
|
||||
|
||||
@@ -56,7 +56,7 @@ function createEarthquakeStyle(feature) {
|
||||
});
|
||||
}
|
||||
|
||||
var maxFeatureCount;
|
||||
var maxFeatureCount, vector;
|
||||
function calculateClusterInfo(resolution) {
|
||||
maxFeatureCount = 0;
|
||||
var features = vector.getSource().getFeatures();
|
||||
@@ -65,7 +65,8 @@ function calculateClusterInfo(resolution) {
|
||||
feature = features[i];
|
||||
var originalFeatures = feature.get('features');
|
||||
var extent = ol.extent.createEmpty();
|
||||
for (var j = 0, jj = originalFeatures.length; j < jj; ++j) {
|
||||
var j, jj;
|
||||
for (j = 0, jj = originalFeatures.length; j < jj; ++j) {
|
||||
ol.extent.extend(extent, originalFeatures[j].getGeometry().getExtent());
|
||||
}
|
||||
maxFeatureCount = Math.max(maxFeatureCount, jj);
|
||||
@@ -104,7 +105,7 @@ function styleFunction(feature, resolution) {
|
||||
return style;
|
||||
}
|
||||
|
||||
function selectStyleFunction(feature, resolution) {
|
||||
function selectStyleFunction(feature) {
|
||||
var styles = [new ol.style.Style({
|
||||
image: new ol.style.Circle({
|
||||
radius: feature.get('radius'),
|
||||
@@ -120,7 +121,7 @@ function selectStyleFunction(feature, resolution) {
|
||||
return styles;
|
||||
}
|
||||
|
||||
var vector = new ol.layer.Vector({
|
||||
vector = new ol.layer.Vector({
|
||||
source: new ol.source.Cluster({
|
||||
distance: 40,
|
||||
source: new ol.source.Vector({
|
||||
|
||||
@@ -14,7 +14,7 @@ goog.require('ol.style.Style');
|
||||
|
||||
|
||||
var styleCache = {};
|
||||
var styleFunction = function(feature, resolution) {
|
||||
var styleFunction = function(feature) {
|
||||
// 2012_Earthquakes_Mag5.kml stores the magnitude of each earthquake in a
|
||||
// standards-violating <magnitude> tag in each Placemark. We extract it from
|
||||
// the Placemark's name instead.
|
||||
@@ -29,8 +29,8 @@ var styleFunction = function(feature, resolution) {
|
||||
/** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d')),
|
||||
{size: [size + 2, size + 2], pixelRatio: size / 10});
|
||||
render.setFillStrokeStyle(
|
||||
new ol.style.Fill({ color: 'rgba(255, 153, 0, 0.4)' }),
|
||||
new ol.style.Stroke({ color: 'rgba(255, 204, 0, 0.2)', width: 1 }));
|
||||
new ol.style.Fill({color: 'rgba(255, 153, 0, 0.4)'}),
|
||||
new ol.style.Stroke({color: 'rgba(255, 204, 0, 0.2)', width: 1}));
|
||||
render.drawPolygonGeometry(new ol.geom.Polygon(
|
||||
[[[0, 0], [4, 2], [6, 0], [10, 5], [6, 3], [4, 5], [0, 0]]]));
|
||||
style = new ol.style.Style({
|
||||
|
||||
@@ -34,7 +34,7 @@ var map = new ol.Map({
|
||||
var exportPNGElement = document.getElementById('export-png');
|
||||
|
||||
if ('download' in exportPNGElement) {
|
||||
exportPNGElement.addEventListener('click', function(e) {
|
||||
exportPNGElement.addEventListener('click', function() {
|
||||
map.once('postcompose', function(event) {
|
||||
var canvas = event.context.canvas;
|
||||
exportPNGElement.href = canvas.toDataURL('image/png');
|
||||
|
||||
3
examples/export-pdf.css
Normal file
3
examples/export-pdf.css
Normal file
@@ -0,0 +1,3 @@
|
||||
.map {
|
||||
max-width: 566px;
|
||||
}
|
||||
33
examples/export-pdf.html
Normal file
33
examples/export-pdf.html
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
layout: example.html
|
||||
title: Export PDF example
|
||||
shortdesc: Example of exporting a map as a PDF.
|
||||
docs: >
|
||||
Example of exporting a map as a PDF using the <a href="https://github.com/MrRio/jsPDF" target="_blank">jsPDF</a> library.
|
||||
tags: "export, pdf, openstreetmap"
|
||||
resources:
|
||||
- http://mrrio.github.io/jsPDF/dist/jspdf.min.js
|
||||
---
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<div id="map" class="map"></div>
|
||||
</div>
|
||||
</div>
|
||||
<form class="form">
|
||||
<label>Page size </label>
|
||||
<select id="format">
|
||||
<option value="a0">A0 (slow)</option>
|
||||
<option value="a1">A1</option>
|
||||
<option value="a2">A2</option>
|
||||
<option value="a3">A3</option>
|
||||
<option value="a4" selected>A4</option>
|
||||
<option value="a5">A5 (fast)</option>
|
||||
</select>
|
||||
<label>Resolution </label>
|
||||
<select id="resolution">
|
||||
<option value="72">72 dpi (fast)</option>
|
||||
<option value="150">150 dpi</option>
|
||||
<option value="300">300 dpi (slow)</option>
|
||||
</select>
|
||||
</form>
|
||||
<button id="export-pdf">Export PDF</button>
|
||||
109
examples/export-pdf.js
Normal file
109
examples/export-pdf.js
Normal file
@@ -0,0 +1,109 @@
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.View');
|
||||
goog.require('ol.control');
|
||||
goog.require('ol.format.WKT');
|
||||
goog.require('ol.layer.Tile');
|
||||
goog.require('ol.layer.Vector');
|
||||
goog.require('ol.source.OSM');
|
||||
goog.require('ol.source.Vector');
|
||||
|
||||
var raster = new ol.layer.Tile({
|
||||
source: new ol.source.OSM()
|
||||
});
|
||||
|
||||
var format = new ol.format.WKT();
|
||||
var feature = format.readFeature(
|
||||
'POLYGON((10.689697265625 -25.0927734375, 34.595947265625 ' +
|
||||
'-20.1708984375, 38.814697265625 -35.6396484375, 13.502197265625 ' +
|
||||
'-39.1552734375, 10.689697265625 -25.0927734375))');
|
||||
feature.getGeometry().transform('EPSG:4326', 'EPSG:3857');
|
||||
|
||||
var vector = new ol.layer.Vector({
|
||||
source: new ol.source.Vector({
|
||||
features: [feature]
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
var map = new ol.Map({
|
||||
layers: [raster, vector],
|
||||
target: 'map',
|
||||
controls: ol.control.defaults({
|
||||
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({
|
||||
collapsible: false
|
||||
})
|
||||
}),
|
||||
view: new ol.View({
|
||||
center: [0, 0],
|
||||
zoom: 2
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
var dims = {
|
||||
a0: [1189, 841],
|
||||
a1: [841, 594],
|
||||
a2: [594, 420],
|
||||
a3: [420, 297],
|
||||
a4: [297, 210],
|
||||
a5: [210, 148]
|
||||
};
|
||||
|
||||
var loading = 0;
|
||||
var loaded = 0;
|
||||
|
||||
var exportButton = document.getElementById('export-pdf');
|
||||
|
||||
exportButton.addEventListener('click', function() {
|
||||
|
||||
exportButton.disabled = true;
|
||||
document.body.style.cursor = 'progress';
|
||||
|
||||
var format = document.getElementById('format').value;
|
||||
var resolution = document.getElementById('resolution').value;
|
||||
var dim = dims[format];
|
||||
var width = Math.round(dim[0] * resolution / 25.4);
|
||||
var height = Math.round(dim[1] * resolution / 25.4);
|
||||
var size = /** @type {ol.Size} */ (map.getSize());
|
||||
var extent = map.getView().calculateExtent(size);
|
||||
|
||||
var source = raster.getSource();
|
||||
|
||||
var tileLoadStart = function() {
|
||||
++loading;
|
||||
};
|
||||
|
||||
var tileLoadEnd = function() {
|
||||
++loaded;
|
||||
if (loading === loaded) {
|
||||
var canvas = this;
|
||||
window.setTimeout(function() {
|
||||
loading = 0;
|
||||
loaded = 0;
|
||||
var data = canvas.toDataURL('image/png');
|
||||
var pdf = new jsPDF('landscape', undefined, format);
|
||||
pdf.addImage(data, 'JPEG', 0, 0, dim[0], dim[1]);
|
||||
pdf.save('map.pdf');
|
||||
source.un('tileloadstart', tileLoadStart);
|
||||
source.un('tileloadend', tileLoadEnd, canvas);
|
||||
source.un('tileloaderror', tileLoadEnd, canvas);
|
||||
map.setSize(size);
|
||||
map.getView().fit(extent, size);
|
||||
map.renderSync();
|
||||
exportButton.disabled = false;
|
||||
document.body.style.cursor = 'auto';
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
|
||||
map.once('postcompose', function(event) {
|
||||
source.on('tileloadstart', tileLoadStart);
|
||||
source.on('tileloadend', tileLoadEnd, event.context.canvas);
|
||||
source.on('tileloaderror', tileLoadEnd, event.context.canvas);
|
||||
});
|
||||
|
||||
map.setSize([width, height]);
|
||||
map.getView().fit(extent, /** @type {ol.Size} */ (map.getSize()));
|
||||
map.renderSync();
|
||||
|
||||
}, false);
|
||||
@@ -108,11 +108,16 @@ var styles = {
|
||||
})
|
||||
};
|
||||
|
||||
var animating = false;
|
||||
var speed, now;
|
||||
var speedInput = document.getElementById('speed');
|
||||
var startButton = document.getElementById('start-animation');
|
||||
|
||||
var vectorLayer = new ol.layer.Vector({
|
||||
source: new ol.source.Vector({
|
||||
features: [routeFeature, geoMarker, startMarker, endMarker]
|
||||
}),
|
||||
style: function(feature, resolution) {
|
||||
style: function(feature) {
|
||||
// hide geoMarker if animation is active
|
||||
if (animating && feature.get('type') === 'geoMarker') {
|
||||
return null;
|
||||
@@ -135,7 +140,7 @@ var map = new ol.Map({
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.BingMaps({
|
||||
imagerySet: 'AerialWithLabels',
|
||||
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3'
|
||||
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF'
|
||||
})
|
||||
}),
|
||||
vectorLayer
|
||||
@@ -198,8 +203,4 @@ function stopAnimation(ended) {
|
||||
map.un('postcompose', moveFeature);
|
||||
}
|
||||
|
||||
var speed, now;
|
||||
var animating = false;
|
||||
var speedInput = document.getElementById('speed');
|
||||
var startButton = document.getElementById('start-animation');
|
||||
startButton.addEventListener('click', startAnimation, false);
|
||||
|
||||
@@ -35,6 +35,14 @@ var defaultStyle = new ol.style.Style({
|
||||
stroke: defaultStroke
|
||||
});
|
||||
|
||||
var flightsSource;
|
||||
var addLater = function(feature, timeout) {
|
||||
window.setTimeout(function() {
|
||||
feature.set('start', new Date().getTime());
|
||||
flightsSource.addFeature(feature);
|
||||
}, timeout);
|
||||
};
|
||||
|
||||
var pointsPerMs = 0.1;
|
||||
var animateFlights = function(event) {
|
||||
var vectorContext = event.vectorContext;
|
||||
@@ -66,20 +74,13 @@ var animateFlights = function(event) {
|
||||
map.render();
|
||||
};
|
||||
|
||||
var addLater = function(feature, timeout) {
|
||||
window.setTimeout(function() {
|
||||
feature.set('start', new Date().getTime());
|
||||
flightsSource.addFeature(feature);
|
||||
}, timeout);
|
||||
};
|
||||
|
||||
var flightsSource = new ol.source.Vector({
|
||||
flightsSource = new ol.source.Vector({
|
||||
wrapX: false,
|
||||
attributions: [new ol.Attribution({
|
||||
html: 'Flight data by ' +
|
||||
'<a href="http://openflights.org/data.html">OpenFlights</a>,'
|
||||
})],
|
||||
loader: function(extent, resolution, projection) {
|
||||
loader: function() {
|
||||
var url = 'data/openflights/flights.json';
|
||||
fetch(url).then(function(response) {
|
||||
return response.json();
|
||||
@@ -116,7 +117,7 @@ var flightsSource = new ol.source.Vector({
|
||||
|
||||
var flightsLayer = new ol.layer.Vector({
|
||||
source: flightsSource,
|
||||
style: function(feature, resolution) {
|
||||
style: function(feature) {
|
||||
// if the animation is still active for a feature, do not
|
||||
// render the feature with the layer style
|
||||
if (feature.get('finished')) {
|
||||
|
||||
@@ -7,6 +7,6 @@ docs: >
|
||||
<p>If there is no button on the map, your browser does not support the <a href="http://caniuse.com/#feat=fullscreen">Full Screen API</a>.</p>
|
||||
tags: "full-screen, drag, rotate, zoom, bing, bing-maps"
|
||||
cloak:
|
||||
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
---
|
||||
<div id="map" class="map"></div>
|
||||
|
||||
@@ -18,7 +18,7 @@ var map = new ol.Map({
|
||||
layers: [
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.BingMaps({
|
||||
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3',
|
||||
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
|
||||
imagerySet: 'Aerial'
|
||||
})
|
||||
})
|
||||
|
||||
44
examples/full-screen-source.css
Normal file
44
examples/full-screen-source.css
Normal file
@@ -0,0 +1,44 @@
|
||||
.fullscreen:-moz-full-screen {
|
||||
height: 100%;
|
||||
}
|
||||
.fullscreen:-webkit-full-screen {
|
||||
height: 100%;
|
||||
}
|
||||
.fullscreen:-ms-fullscreen {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.fullscreen:fullscreen {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.fullscreen {
|
||||
margin-bottom: 10px;
|
||||
width: 100%;
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
.ol-rotate {
|
||||
top: 3em;
|
||||
}
|
||||
|
||||
.map {
|
||||
width: 80%;
|
||||
height: 100%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.sidepanel {
|
||||
background: #1F6B75;
|
||||
width: 20%;
|
||||
height: 100%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.sidepanel-title {
|
||||
width: 100%;
|
||||
font-size: 3em;
|
||||
color: #ffffff;
|
||||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
16
examples/full-screen-source.html
Normal file
16
examples/full-screen-source.html
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
layout: example.html
|
||||
title: Full Screen Control with extended source element
|
||||
shortdesc: Example of a full screen control with a source option definition.
|
||||
docs: >
|
||||
<p>Click the control in the top right corner to go full screen. Click it again to exit full screen.</p>
|
||||
<p>If there is no button on the map, your browser does not support the <a href="http://caniuse.com/#feat=fullscreen">Full Screen API</a>.</p>
|
||||
tags: "full-screen, source, fullScreenSource, osm, osm-maps"
|
||||
---
|
||||
<div id="fullscreen" class="fullscreen">
|
||||
<div id="map" class="map"></div>
|
||||
<div class="sidepanel">
|
||||
<span class="sidepanel-title">Side Panel</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
28
examples/full-screen-source.js
Normal file
28
examples/full-screen-source.js
Normal file
@@ -0,0 +1,28 @@
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.View');
|
||||
goog.require('ol.control');
|
||||
goog.require('ol.control.FullScreen');
|
||||
goog.require('ol.layer.Tile');
|
||||
goog.require('ol.source.OSM');
|
||||
|
||||
|
||||
var view = new ol.View({
|
||||
center: [-9101767, 2822912],
|
||||
zoom: 14
|
||||
});
|
||||
|
||||
var map = new ol.Map({
|
||||
controls: ol.control.defaults().extend([
|
||||
new ol.control.FullScreen({
|
||||
source: 'fullscreen'
|
||||
})
|
||||
]),
|
||||
layers: [
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.OSM()
|
||||
})
|
||||
],
|
||||
renderer: common.getRendererFromQueryString(),
|
||||
target: 'map',
|
||||
view: view
|
||||
});
|
||||
@@ -7,6 +7,6 @@ docs: >
|
||||
<p>If there is no button on the map, your browser does not support the <a href="http://caniuse.com/#feat=fullscreen">Full Screen API</a>.</p>
|
||||
tags: "full-screen, bing, bing-maps"
|
||||
cloak:
|
||||
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
---
|
||||
<div id="map" class="map"></div>
|
||||
|
||||
@@ -18,7 +18,7 @@ var map = new ol.Map({
|
||||
layers: [
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.BingMaps({
|
||||
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3',
|
||||
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
|
||||
imagerySet: 'Aerial'
|
||||
})
|
||||
})
|
||||
|
||||
@@ -85,7 +85,7 @@ var styles = {
|
||||
})
|
||||
};
|
||||
|
||||
var styleFunction = function(feature, resolution) {
|
||||
var styleFunction = function(feature) {
|
||||
return styles[feature.getGeometry().getType()];
|
||||
};
|
||||
|
||||
@@ -97,79 +97,67 @@ var geojsonObject = {
|
||||
'name': 'EPSG:3857'
|
||||
}
|
||||
},
|
||||
'features': [
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Point',
|
||||
'coordinates': [0, 0]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[4e6, -2e6], [8e6, 2e6]]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[4e6, 2e6], [8e6, -2e6]]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[-5e6, -1e6], [-4e6, 1e6], [-3e6, -1e6]]]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'MultiLineString',
|
||||
'coordinates': [
|
||||
[[-1e6, -7.5e5], [-1e6, 7.5e5]],
|
||||
[[1e6, -7.5e5], [1e6, 7.5e5]],
|
||||
[[-7.5e5, -1e6], [7.5e5, -1e6]],
|
||||
[[-7.5e5, 1e6], [7.5e5, 1e6]]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'MultiPolygon',
|
||||
'coordinates': [
|
||||
[[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6], [-3e6, 6e6]]],
|
||||
[[[-2e6, 6e6], [-2e6, 8e6], [0, 8e6], [0, 6e6]]],
|
||||
[[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6], [3e6, 6e6]]]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'GeometryCollection',
|
||||
'geometries': [
|
||||
{
|
||||
'type': 'LineString',
|
||||
'coordinates': [[-5e6, -5e6], [0, -5e6]]
|
||||
},
|
||||
{
|
||||
'type': 'Point',
|
||||
'coordinates': [4e6, -5e6]
|
||||
},
|
||||
{
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[1e6, -6e6], [2e6, -4e6], [3e6, -6e6]]]
|
||||
}
|
||||
]
|
||||
}
|
||||
'features': [{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Point',
|
||||
'coordinates': [0, 0]
|
||||
}
|
||||
]
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[4e6, -2e6], [8e6, 2e6]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[4e6, 2e6], [8e6, -2e6]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[-5e6, -1e6], [-4e6, 1e6], [-3e6, -1e6]]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'MultiLineString',
|
||||
'coordinates': [
|
||||
[[-1e6, -7.5e5], [-1e6, 7.5e5]],
|
||||
[[1e6, -7.5e5], [1e6, 7.5e5]],
|
||||
[[-7.5e5, -1e6], [7.5e5, -1e6]],
|
||||
[[-7.5e5, 1e6], [7.5e5, 1e6]]
|
||||
]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'MultiPolygon',
|
||||
'coordinates': [
|
||||
[[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6], [-3e6, 6e6]]],
|
||||
[[[-2e6, 6e6], [-2e6, 8e6], [0, 8e6], [0, 6e6]]],
|
||||
[[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6], [3e6, 6e6]]]
|
||||
]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'GeometryCollection',
|
||||
'geometries': [{
|
||||
'type': 'LineString',
|
||||
'coordinates': [[-5e6, -5e6], [0, -5e6]]
|
||||
}, {
|
||||
'type': 'Point',
|
||||
'coordinates': [4e6, -5e6]
|
||||
}, {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[1e6, -6e6], [2e6, -4e6], [3e6, -6e6]]]
|
||||
}]
|
||||
}
|
||||
}]
|
||||
};
|
||||
|
||||
var vectorSource = new ol.source.Vector({
|
||||
|
||||
@@ -58,7 +58,7 @@ var geolocation = new ol.Geolocation(/** @type {olx.GeolocationOptions} */ ({
|
||||
var deltaMean = 500; // the geolocation sampling period mean in ms
|
||||
|
||||
// Listen to position changes
|
||||
geolocation.on('change', function(evt) {
|
||||
geolocation.on('change', function() {
|
||||
var position = geolocation.getPosition();
|
||||
var accuracy = geolocation.getAccuracy();
|
||||
var heading = geolocation.getHeading() || 0;
|
||||
@@ -113,7 +113,7 @@ function addPosition(position, heading, m, speed) {
|
||||
// force the rotation change to be less than 180°
|
||||
if (Math.abs(headingDiff) > Math.PI) {
|
||||
var sign = (headingDiff >= 0) ? 1 : -1;
|
||||
headingDiff = - sign * (2 * Math.PI - Math.abs(headingDiff));
|
||||
headingDiff = -sign * (2 * Math.PI - Math.abs(headingDiff));
|
||||
}
|
||||
heading = prevHeading + headingDiff;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ geolocation.on('change:position', function() {
|
||||
new ol.geom.Point(coordinates) : null);
|
||||
});
|
||||
|
||||
var featuresOverlay = new ol.layer.Vector({
|
||||
new ol.layer.Vector({
|
||||
map: map,
|
||||
source: new ol.source.Vector({
|
||||
features: [accuracyFeature, positionFeature]
|
||||
|
||||
@@ -44,7 +44,7 @@ map.on('pointermove', function(evt) {
|
||||
return;
|
||||
}
|
||||
var pixel = map.getEventPixel(evt.originalEvent);
|
||||
var hit = map.forEachLayerAtPixel(pixel, function(layer) {
|
||||
var hit = map.forEachLayerAtPixel(pixel, function() {
|
||||
return true;
|
||||
});
|
||||
map.getTargetElement().style.cursor = hit ? 'pointer' : '';
|
||||
|
||||
28
examples/getfeatureinfo-layers.html
Normal file
28
examples/getfeatureinfo-layers.html
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
layout: example.html
|
||||
title: WMS GetFeatureInfo (Layers)
|
||||
shortdesc: >
|
||||
Shows how to fetch features per layer name in a single WMS GetFeatureInfo
|
||||
request
|
||||
docs: >
|
||||
Demonstrates the use of the `layers` option in the
|
||||
`ol.format.WMSGetFeatureInfo` format object, which allows features returned
|
||||
by a single WMS GetFeatureInfo request that asks for more than one layer
|
||||
to be read by layer name.
|
||||
resources:
|
||||
- https://code.jquery.com/jquery-1.11.2.min.js
|
||||
---
|
||||
<table id="info">
|
||||
<tr>
|
||||
<td>All features:</td>
|
||||
<td id="all"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Hotel features:</td>
|
||||
<td id="hotel"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Restaurant features:</td>
|
||||
<td id="restaurant"></td>
|
||||
</tr>
|
||||
</table>
|
||||
24
examples/getfeatureinfo-layers.js
Normal file
24
examples/getfeatureinfo-layers.js
Normal file
@@ -0,0 +1,24 @@
|
||||
goog.require('ol.format.WMSGetFeatureInfo');
|
||||
|
||||
$.ajax({
|
||||
url: './data/wmsgetfeatureinfo/osm-restaurant-hotel.xml',
|
||||
success: function(response) {
|
||||
|
||||
// this is the standard way to read the features
|
||||
var allFeatures = new ol.format.WMSGetFeatureInfo().readFeatures(response);
|
||||
$('#all').html(allFeatures.length.toString());
|
||||
|
||||
// when specifying the 'layers' options, only the features of those
|
||||
// layers are returned by the format
|
||||
var hotelFeatures = new ol.format.WMSGetFeatureInfo({
|
||||
layers: ['hotel']
|
||||
}).readFeatures(response);
|
||||
$('#hotel').html(hotelFeatures.length.toString());
|
||||
|
||||
var restaurantFeatures = new ol.format.WMSGetFeatureInfo({
|
||||
layers: ['restaurant']
|
||||
}).readFeatures(response);
|
||||
$('#restaurant').html(restaurantFeatures.length.toString());
|
||||
|
||||
}
|
||||
});
|
||||
@@ -44,7 +44,7 @@ map.on('pointermove', function(evt) {
|
||||
return;
|
||||
}
|
||||
var pixel = map.getEventPixel(evt.originalEvent);
|
||||
var hit = map.forEachLayerAtPixel(pixel, function(layer) {
|
||||
var hit = map.forEachLayerAtPixel(pixel, function() {
|
||||
return true;
|
||||
});
|
||||
map.getTargetElement().style.cursor = hit ? 'pointer' : '';
|
||||
|
||||
@@ -6,7 +6,7 @@ docs: >
|
||||
Example of using the GPX source.
|
||||
tags: "GPX"
|
||||
cloak:
|
||||
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
---
|
||||
<div id="map" class="map"></div>
|
||||
<div id="info"> </div>
|
||||
|
||||
@@ -3,7 +3,6 @@ goog.require('ol.View');
|
||||
goog.require('ol.format.GPX');
|
||||
goog.require('ol.layer.Tile');
|
||||
goog.require('ol.layer.Vector');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.source.BingMaps');
|
||||
goog.require('ol.source.Vector');
|
||||
goog.require('ol.style.Circle');
|
||||
@@ -11,12 +10,10 @@ goog.require('ol.style.Fill');
|
||||
goog.require('ol.style.Stroke');
|
||||
goog.require('ol.style.Style');
|
||||
|
||||
var projection = ol.proj.get('EPSG:3857');
|
||||
|
||||
var raster = new ol.layer.Tile({
|
||||
source: new ol.source.BingMaps({
|
||||
imagerySet: 'Aerial',
|
||||
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3'
|
||||
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF'
|
||||
})
|
||||
});
|
||||
|
||||
@@ -52,7 +49,7 @@ var vector = new ol.layer.Vector({
|
||||
url: 'data/gpx/fells_loop.gpx',
|
||||
format: new ol.format.GPX()
|
||||
}),
|
||||
style: function(feature, resolution) {
|
||||
style: function(feature) {
|
||||
return style[feature.getGeometry().getType()];
|
||||
}
|
||||
});
|
||||
@@ -68,7 +65,7 @@ var map = new ol.Map({
|
||||
|
||||
var displayFeatureInfo = function(pixel) {
|
||||
var features = [];
|
||||
map.forEachFeatureAtPixel(pixel, function(feature, layer) {
|
||||
map.forEachFeatureAtPixel(pixel, function(feature) {
|
||||
features.push(feature);
|
||||
});
|
||||
if (features.length > 0) {
|
||||
|
||||
3
examples/icon-color.css
Normal file
3
examples/icon-color.css
Normal file
@@ -0,0 +1,3 @@
|
||||
#map {
|
||||
position: relative;
|
||||
}
|
||||
10
examples/icon-color.html
Normal file
10
examples/icon-color.html
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
layout: example.html
|
||||
title: Icon Colors
|
||||
shortdesc: Example assigning a custom color to an icon
|
||||
docs: >
|
||||
Example assigning a custom color to an icon. The features in this examples are all using the same image with the different colors coming from the javascript file
|
||||
tags: "vector, style, icon, marker"
|
||||
resources:
|
||||
---
|
||||
<div id="map" class="map"></div>
|
||||
71
examples/icon-color.js
Normal file
71
examples/icon-color.js
Normal file
@@ -0,0 +1,71 @@
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.View');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.layer.Tile');
|
||||
goog.require('ol.layer.Vector');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.source.TileJSON');
|
||||
goog.require('ol.source.Vector');
|
||||
goog.require('ol.style.Icon');
|
||||
goog.require('ol.style.Style');
|
||||
|
||||
|
||||
var rome = new ol.Feature({
|
||||
geometry: new ol.geom.Point(ol.proj.fromLonLat([12.5, 41.9]))
|
||||
});
|
||||
|
||||
var london = new ol.Feature({
|
||||
geometry: new ol.geom.Point(ol.proj.fromLonLat([-0.12755, 51.507222]))
|
||||
});
|
||||
|
||||
var madrid = new ol.Feature({
|
||||
geometry: new ol.geom.Point(ol.proj.fromLonLat([-3.683333, 40.4]))
|
||||
});
|
||||
|
||||
rome.setStyle(new ol.style.Style({
|
||||
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
|
||||
color: '#8959A8',
|
||||
src: 'data/dot.png'
|
||||
}))
|
||||
}));
|
||||
|
||||
london.setStyle(new ol.style.Style({
|
||||
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
|
||||
color: '#4271AE',
|
||||
src: 'data/dot.png'
|
||||
}))
|
||||
}));
|
||||
|
||||
madrid.setStyle(new ol.style.Style({
|
||||
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
|
||||
color: [113, 140, 0],
|
||||
src: 'data/dot.png'
|
||||
}))
|
||||
}));
|
||||
|
||||
|
||||
var vectorSource = new ol.source.Vector({
|
||||
features: [rome, london, madrid]
|
||||
});
|
||||
|
||||
var vectorLayer = new ol.layer.Vector({
|
||||
source: vectorSource
|
||||
});
|
||||
|
||||
var rasterLayer = new ol.layer.Tile({
|
||||
source: new ol.source.TileJSON({
|
||||
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.json',
|
||||
crossOrigin: ''
|
||||
})
|
||||
});
|
||||
|
||||
var map = new ol.Map({
|
||||
renderer: common.getRendererFromQueryString(),
|
||||
layers: [rasterLayer, vectorLayer],
|
||||
target: document.getElementById('map'),
|
||||
view: new ol.View({
|
||||
center: ol.proj.fromLonLat([2.896372, 44.60240]),
|
||||
zoom: 3
|
||||
})
|
||||
});
|
||||
@@ -28,11 +28,13 @@ iconFeature.set('style', createStyle('data/icon.png', undefined));
|
||||
var map = new ol.Map({
|
||||
layers: [
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.Stamen({ layer: 'watercolor' })
|
||||
source: new ol.source.Stamen({layer: 'watercolor'})
|
||||
}),
|
||||
new ol.layer.Vector({
|
||||
style: function(feature) { return feature.get('style'); },
|
||||
source: new ol.source.Vector({ features: [iconFeature] })
|
||||
style: function(feature) {
|
||||
return feature.get('style');
|
||||
},
|
||||
source: new ol.source.Vector({features: [iconFeature]})
|
||||
})
|
||||
],
|
||||
target: document.getElementById('map'),
|
||||
@@ -44,7 +46,7 @@ var map = new ol.Map({
|
||||
|
||||
var selectStyle = {};
|
||||
var select = new ol.interaction.Select({
|
||||
style: function(feature, resolution) {
|
||||
style: function(feature) {
|
||||
var image = feature.get('style').getImage().getImage();
|
||||
if (!selectStyle[image.src]) {
|
||||
var canvas = document.createElement('canvas');
|
||||
|
||||
@@ -95,7 +95,7 @@ for (i = 0; i < featureCount; i += 30) {
|
||||
overlayFeatures.push(clone);
|
||||
}
|
||||
|
||||
var featureOverlay = new ol.layer.Vector({
|
||||
new ol.layer.Vector({
|
||||
map: map,
|
||||
source: new ol.source.Vector({
|
||||
features: overlayFeatures
|
||||
@@ -112,8 +112,8 @@ map.on('click', function(evt) {
|
||||
|
||||
window.setTimeout(function() {
|
||||
var features = [];
|
||||
map.forEachFeatureAtPixel(evt.pixel, function(feature, layer) {
|
||||
features.push(features);
|
||||
map.forEachFeatureAtPixel(evt.pixel, function(feature) {
|
||||
features.push(feature);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ var iconStyle = new ol.style.Style({
|
||||
anchor: [0.5, 46],
|
||||
anchorXUnits: 'fraction',
|
||||
anchorYUnits: 'pixels',
|
||||
opacity: 0.75,
|
||||
src: 'data/icon.png'
|
||||
}))
|
||||
});
|
||||
@@ -40,7 +39,7 @@ var vectorLayer = new ol.layer.Vector({
|
||||
|
||||
var rasterLayer = new ol.layer.Tile({
|
||||
source: new ol.source.TileJSON({
|
||||
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.jsonp',
|
||||
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.json',
|
||||
crossOrigin: ''
|
||||
})
|
||||
});
|
||||
@@ -67,7 +66,7 @@ map.addOverlay(popup);
|
||||
// display popup on click
|
||||
map.on('click', function(evt) {
|
||||
var feature = map.forEachFeatureAtPixel(evt.pixel,
|
||||
function(feature, layer) {
|
||||
function(feature) {
|
||||
return feature;
|
||||
});
|
||||
if (feature) {
|
||||
|
||||
@@ -25,7 +25,7 @@ var colors = {
|
||||
};
|
||||
|
||||
var styleCache = {};
|
||||
var styleFunction = function(feature, resolution) {
|
||||
var styleFunction = function(feature) {
|
||||
var color = colors[feature.get('PLT')];
|
||||
var style = styleCache[color];
|
||||
if (!style) {
|
||||
|
||||
@@ -8,7 +8,7 @@ docs: >
|
||||
In this example, the <code>postcompose</code> listener applies a filter to the image data.</p>
|
||||
tags: "filter, image manipulation"
|
||||
cloak:
|
||||
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
---
|
||||
<div id="map" class="map"></div>
|
||||
<select id="kernel" name="kernel">
|
||||
|
||||
@@ -4,7 +4,7 @@ goog.require('ol.layer.Tile');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.source.BingMaps');
|
||||
|
||||
var key = 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3';
|
||||
var key = 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF';
|
||||
|
||||
var imagery = new ol.layer.Tile({
|
||||
source: new ol.source.BingMaps({key: key, imagerySet: 'Aerial'})
|
||||
|
||||
@@ -4,7 +4,6 @@ goog.require('ol.layer.Image');
|
||||
goog.require('ol.source.ImageWMS');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Renders a progress bar.
|
||||
* @param {Element} el The target element.
|
||||
@@ -84,14 +83,14 @@ var source = new ol.source.ImageWMS({
|
||||
serverType: 'geoserver'
|
||||
});
|
||||
|
||||
source.on('imageloadstart', function(event) {
|
||||
source.on('imageloadstart', function() {
|
||||
progress.addLoading();
|
||||
});
|
||||
|
||||
source.on('imageloadend', function(event) {
|
||||
source.on('imageloadend', function() {
|
||||
progress.addLoaded();
|
||||
});
|
||||
source.on('imageloaderror', function(event) {
|
||||
source.on('imageloaderror', function() {
|
||||
progress.addLoaded();
|
||||
});
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ var featureOverlay = new ol.layer.Vector({
|
||||
var highlight;
|
||||
var displayFeatureInfo = function(pixel) {
|
||||
|
||||
var feature = map.forEachFeatureAtPixel(pixel, function(feature, layer) {
|
||||
var feature = map.forEachFeatureAtPixel(pixel, function(feature) {
|
||||
return feature;
|
||||
});
|
||||
|
||||
|
||||
@@ -187,10 +187,16 @@
|
||||
<header class="navbar navbar-fixed-top" role="navigation">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png"> OpenLayers 3 Examples</a>
|
||||
<form class="navbar-form navbar-left" role="search">
|
||||
<form class="navbar-form navbar-left search-form" role="search">
|
||||
<input name="q" type="text" id="keywords" class="search-query" placeholder="Search" autofocus>
|
||||
<span id="count"></span>
|
||||
</form>
|
||||
<ul class="nav navbar-nav pull-right">
|
||||
<li><a href="../doc">Docs</a></li>
|
||||
<li><a class="active" href="index.html">Examples</a></li>
|
||||
<li><a href="../apidoc">API</a></li>
|
||||
<li><a href="https://github.com/openlayers/ol3">Code</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ goog.require('ol.style.Style');
|
||||
|
||||
|
||||
var styleCache = {};
|
||||
var styleFunction = function(feature, resolution) {
|
||||
var styleFunction = function(feature) {
|
||||
// 2012_Earthquakes_Mag5.kml stores the magnitude of each earthquake in a
|
||||
// standards-violating <magnitude> tag in each Placemark. We extract it from
|
||||
// the Placemark's name instead.
|
||||
@@ -74,7 +74,7 @@ var displayFeatureInfo = function(pixel) {
|
||||
left: pixel[0] + 'px',
|
||||
top: (pixel[1] - 15) + 'px'
|
||||
});
|
||||
var feature = map.forEachFeatureAtPixel(pixel, function(feature, layer) {
|
||||
var feature = map.forEachFeatureAtPixel(pixel, function(feature) {
|
||||
return feature;
|
||||
});
|
||||
if (feature) {
|
||||
|
||||
@@ -17,7 +17,7 @@ goog.require('ol.style.Style');
|
||||
* currently midnight would have an opacity of 0. This doesn't account for
|
||||
* daylight savings, so don't use it to plan your vacation.
|
||||
*/
|
||||
var styleFunction = function(feature, resolution) {
|
||||
var styleFunction = function(feature) {
|
||||
var offset = 0;
|
||||
var name = feature.get('name'); // e.g. GMT -08:30
|
||||
var match = name.match(/([\-+]\d{2}):(\d{2})$/);
|
||||
@@ -81,7 +81,7 @@ var displayFeatureInfo = function(pixel) {
|
||||
left: pixel[0] + 'px',
|
||||
top: (pixel[1] - 15) + 'px'
|
||||
});
|
||||
var feature = map.forEachFeatureAtPixel(pixel, function(feature, layer) {
|
||||
var feature = map.forEachFeatureAtPixel(pixel, function(feature) {
|
||||
return feature;
|
||||
});
|
||||
if (feature) {
|
||||
|
||||
@@ -6,7 +6,7 @@ docs: >
|
||||
This example uses the <code>ol.format.KML</code> to parse KML for rendering with a vector source.
|
||||
tags: "KML"
|
||||
cloak:
|
||||
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
---
|
||||
<div id="map" class="map"></div>
|
||||
<div id="info"> </div>
|
||||
|
||||
@@ -12,7 +12,7 @@ var projection = ol.proj.get('EPSG:3857');
|
||||
var raster = new ol.layer.Tile({
|
||||
source: new ol.source.BingMaps({
|
||||
imagerySet: 'Aerial',
|
||||
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3'
|
||||
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF'
|
||||
})
|
||||
});
|
||||
|
||||
@@ -35,7 +35,7 @@ var map = new ol.Map({
|
||||
|
||||
var displayFeatureInfo = function(pixel) {
|
||||
var features = [];
|
||||
map.forEachFeatureAtPixel(pixel, function(feature, layer) {
|
||||
map.forEachFeatureAtPixel(pixel, function(feature) {
|
||||
features.push(feature);
|
||||
});
|
||||
if (features.length > 0) {
|
||||
|
||||
@@ -25,8 +25,10 @@ var map = new ol.Map({
|
||||
osm.on('precompose', function(event) {
|
||||
var ctx = event.context;
|
||||
ctx.save();
|
||||
ctx.translate(ctx.canvas.width / 2, ctx.canvas.height / 2);
|
||||
ctx.scale(3, 3);
|
||||
var pixelRatio = event.frameState.pixelRatio;
|
||||
var size = map.getSize();
|
||||
ctx.translate(size[0] / 2 * pixelRatio, size[1] / 2 * pixelRatio);
|
||||
ctx.scale(3 * pixelRatio, 3 * pixelRatio);
|
||||
ctx.translate(-75, -80);
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(75, 40);
|
||||
@@ -37,7 +39,9 @@ osm.on('precompose', function(event) {
|
||||
ctx.bezierCurveTo(130, 62.5, 130, 25, 100, 25);
|
||||
ctx.bezierCurveTo(85, 25, 75, 37, 75, 40);
|
||||
ctx.clip();
|
||||
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||||
ctx.translate(75, 80);
|
||||
ctx.scale(1 / 3 / pixelRatio, 1 / 3 / pixelRatio);
|
||||
ctx.translate(-size[0] / 2 * pixelRatio, -size[1] / 2 * pixelRatio);
|
||||
});
|
||||
|
||||
osm.on('postcompose', function(event) {
|
||||
|
||||
@@ -19,7 +19,7 @@ var extents = {
|
||||
var base = new ol.layer.Tile({
|
||||
source: new ol.source.TileJSON({
|
||||
url: 'http://api.tiles.mapbox.com/v3/' +
|
||||
'mapbox.world-black.jsonp',
|
||||
'mapbox.world-black.json',
|
||||
crossOrigin: 'anonymous'
|
||||
})
|
||||
});
|
||||
@@ -28,7 +28,7 @@ var overlay = new ol.layer.Tile({
|
||||
extent: extents.northwest,
|
||||
source: new ol.source.TileJSON({
|
||||
url: 'http://api.tiles.mapbox.com/v3/' +
|
||||
'mapbox.world-glass.jsonp',
|
||||
'mapbox.world-glass.json',
|
||||
crossOrigin: 'anonymous'
|
||||
})
|
||||
});
|
||||
|
||||
@@ -15,14 +15,14 @@ var map = new ol.Map({
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.TileJSON({
|
||||
url: 'http://api.tiles.mapbox.com/v3/' +
|
||||
'mapbox.20110804-hoa-foodinsecurity-3month.jsonp',
|
||||
'mapbox.20110804-hoa-foodinsecurity-3month.json',
|
||||
crossOrigin: 'anonymous'
|
||||
})
|
||||
}),
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.TileJSON({
|
||||
url: 'http://api.tiles.mapbox.com/v3/' +
|
||||
'mapbox.world-borders-light.jsonp',
|
||||
'mapbox.world-borders-light.json',
|
||||
crossOrigin: 'anonymous'
|
||||
})
|
||||
})
|
||||
|
||||
@@ -10,6 +10,6 @@ docs: >
|
||||
<p>Move around the map to see the effect. Use the ↑ up and ↓ down arrow keys to adjust the spyglass size.</p>
|
||||
tags: "spy, image manipulation"
|
||||
cloak:
|
||||
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
---
|
||||
<div id="map" class="map"></div>
|
||||
|
||||
@@ -4,7 +4,7 @@ goog.require('ol.layer.Tile');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.source.BingMaps');
|
||||
|
||||
var key = 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3';
|
||||
var key = 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF';
|
||||
|
||||
var roads = new ol.layer.Tile({
|
||||
source: new ol.source.BingMaps({key: key, imagerySet: 'Road'})
|
||||
|
||||
@@ -6,7 +6,7 @@ docs: >
|
||||
Example of a Layer swipe map.
|
||||
tags: "swipe, openstreetmap"
|
||||
cloak:
|
||||
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
---
|
||||
<div id="map" class="map"></div>
|
||||
<input id="swipe" type="range" style="width: 100%">
|
||||
|
||||
@@ -10,7 +10,7 @@ var osm = new ol.layer.Tile({
|
||||
});
|
||||
var bing = new ol.layer.Tile({
|
||||
source: new ol.source.BingMaps({
|
||||
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3',
|
||||
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
|
||||
imagerySet: 'Aerial'
|
||||
})
|
||||
});
|
||||
|
||||
@@ -16,7 +16,7 @@ var raster = new ol.layer.Tile({
|
||||
|
||||
var source = new ol.source.Vector();
|
||||
|
||||
var styleFunction = function(feature, resolution) {
|
||||
var styleFunction = function(feature) {
|
||||
var geometry = feature.getGeometry();
|
||||
var styles = [
|
||||
// linestring
|
||||
|
||||
@@ -3,8 +3,7 @@ layout: example.html
|
||||
title: Localized OpenStreetMap
|
||||
shortdesc: Example of a localized OpenStreetMap map with a custom tile server and a custom attribution.
|
||||
docs: >
|
||||
<p>The base layer is <a href="http://www.opencyclemap.org/">OpenCycleMap</a> with an overlay from <a href="http://www.openseamap.org/">OpenSeaMap</a>. The OpenSeaMap tile server
|
||||
does not support <a href="http://enable-cors.org/">CORS</a> headers.</p>
|
||||
tags: "cors, localized-openstreetmap, openseamap, openstreetmap"
|
||||
<p>The base layer is <a href="http://www.opencyclemap.org/">OpenCycleMap</a> with an overlay from <a href="http://www.openseamap.org/">OpenSeaMap</a>.
|
||||
tags: "localized-openstreetmap, openseamap, openstreetmap"
|
||||
---
|
||||
<div id="map" class="map"></div>
|
||||
|
||||
@@ -28,7 +28,7 @@ var openSeaMapLayer = new ol.layer.Tile({
|
||||
}),
|
||||
ol.source.OSM.ATTRIBUTION
|
||||
],
|
||||
crossOrigin: null,
|
||||
opaque: false,
|
||||
url: 'http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png'
|
||||
})
|
||||
});
|
||||
|
||||
@@ -96,7 +96,7 @@ var continueLineMsg = 'Click to continue drawing the line';
|
||||
|
||||
/**
|
||||
* Handle pointer move.
|
||||
* @param {ol.MapBrowserEvent} evt
|
||||
* @param {ol.MapBrowserEvent} evt The event.
|
||||
*/
|
||||
var pointerMoveHandler = function(evt) {
|
||||
if (evt.dragging) {
|
||||
@@ -140,6 +140,66 @@ var typeSelect = document.getElementById('type');
|
||||
var geodesicCheckbox = document.getElementById('geodesic');
|
||||
|
||||
var draw; // global so we can remove it later
|
||||
|
||||
|
||||
/**
|
||||
* Format length output.
|
||||
* @param {ol.geom.LineString} line The line.
|
||||
* @return {string} The formatted length.
|
||||
*/
|
||||
var formatLength = function(line) {
|
||||
var length;
|
||||
if (geodesicCheckbox.checked) {
|
||||
var coordinates = line.getCoordinates();
|
||||
length = 0;
|
||||
var sourceProj = map.getView().getProjection();
|
||||
for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) {
|
||||
var c1 = ol.proj.transform(coordinates[i], sourceProj, 'EPSG:4326');
|
||||
var c2 = ol.proj.transform(coordinates[i + 1], sourceProj, 'EPSG:4326');
|
||||
length += wgs84Sphere.haversineDistance(c1, c2);
|
||||
}
|
||||
} else {
|
||||
length = Math.round(line.getLength() * 100) / 100;
|
||||
}
|
||||
var output;
|
||||
if (length > 100) {
|
||||
output = (Math.round(length / 1000 * 100) / 100) +
|
||||
' ' + 'km';
|
||||
} else {
|
||||
output = (Math.round(length * 100) / 100) +
|
||||
' ' + 'm';
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Format length output.
|
||||
* @param {ol.geom.Polygon} polygon The polygon.
|
||||
* @return {string} Formatted area.
|
||||
*/
|
||||
var formatArea = function(polygon) {
|
||||
var area;
|
||||
if (geodesicCheckbox.checked) {
|
||||
var sourceProj = map.getView().getProjection();
|
||||
var geom = /** @type {ol.geom.Polygon} */(polygon.clone().transform(
|
||||
sourceProj, 'EPSG:4326'));
|
||||
var coordinates = geom.getLinearRing(0).getCoordinates();
|
||||
area = Math.abs(wgs84Sphere.geodesicArea(coordinates));
|
||||
} else {
|
||||
area = polygon.getArea();
|
||||
}
|
||||
var output;
|
||||
if (area > 10000) {
|
||||
output = (Math.round(area / 1000000 * 100) / 100) +
|
||||
' ' + 'km<sup>2</sup>';
|
||||
} else {
|
||||
output = (Math.round(area * 100) / 100) +
|
||||
' ' + 'm<sup>2</sup>';
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
function addInteraction() {
|
||||
var type = (typeSelect.value == 'area' ? 'Polygon' : 'LineString');
|
||||
draw = new ol.interaction.Draw({
|
||||
@@ -186,7 +246,7 @@ function addInteraction() {
|
||||
output = formatArea(/** @type {ol.geom.Polygon} */ (geom));
|
||||
tooltipCoord = geom.getInteriorPoint().getCoordinates();
|
||||
} else if (geom instanceof ol.geom.LineString) {
|
||||
output = formatLength( /** @type {ol.geom.LineString} */ (geom));
|
||||
output = formatLength(/** @type {ol.geom.LineString} */ (geom));
|
||||
tooltipCoord = geom.getLastCoordinate();
|
||||
}
|
||||
measureTooltipElement.innerHTML = output;
|
||||
@@ -195,7 +255,7 @@ function addInteraction() {
|
||||
}, this);
|
||||
|
||||
draw.on('drawend',
|
||||
function(evt) {
|
||||
function() {
|
||||
measureTooltipElement.className = 'tooltip tooltip-static';
|
||||
measureTooltip.setOffset([0, -7]);
|
||||
// unset sketch
|
||||
@@ -246,70 +306,10 @@ function createMeasureTooltip() {
|
||||
|
||||
/**
|
||||
* Let user change the geometry type.
|
||||
* @param {Event} e Change event.
|
||||
*/
|
||||
typeSelect.onchange = function(e) {
|
||||
typeSelect.onchange = function() {
|
||||
map.removeInteraction(draw);
|
||||
addInteraction();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* format length output
|
||||
* @param {ol.geom.LineString} line
|
||||
* @return {string}
|
||||
*/
|
||||
var formatLength = function(line) {
|
||||
var length;
|
||||
if (geodesicCheckbox.checked) {
|
||||
var coordinates = line.getCoordinates();
|
||||
length = 0;
|
||||
var sourceProj = map.getView().getProjection();
|
||||
for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) {
|
||||
var c1 = ol.proj.transform(coordinates[i], sourceProj, 'EPSG:4326');
|
||||
var c2 = ol.proj.transform(coordinates[i + 1], sourceProj, 'EPSG:4326');
|
||||
length += wgs84Sphere.haversineDistance(c1, c2);
|
||||
}
|
||||
} else {
|
||||
length = Math.round(line.getLength() * 100) / 100;
|
||||
}
|
||||
var output;
|
||||
if (length > 100) {
|
||||
output = (Math.round(length / 1000 * 100) / 100) +
|
||||
' ' + 'km';
|
||||
} else {
|
||||
output = (Math.round(length * 100) / 100) +
|
||||
' ' + 'm';
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* format length output
|
||||
* @param {ol.geom.Polygon} polygon
|
||||
* @return {string}
|
||||
*/
|
||||
var formatArea = function(polygon) {
|
||||
var area;
|
||||
if (geodesicCheckbox.checked) {
|
||||
var sourceProj = map.getView().getProjection();
|
||||
var geom = /** @type {ol.geom.Polygon} */(polygon.clone().transform(
|
||||
sourceProj, 'EPSG:4326'));
|
||||
var coordinates = geom.getLinearRing(0).getCoordinates();
|
||||
area = Math.abs(wgs84Sphere.geodesicArea(coordinates));
|
||||
} else {
|
||||
area = polygon.getArea();
|
||||
}
|
||||
var output;
|
||||
if (area > 10000) {
|
||||
output = (Math.round(area / 1000000 * 100) / 100) +
|
||||
' ' + 'km<sup>2</sup>';
|
||||
} else {
|
||||
output = (Math.round(area * 100) / 100) +
|
||||
' ' + 'm<sup>2</sup>';
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
addInteraction();
|
||||
|
||||
@@ -19,7 +19,7 @@ var map = new ol.Map({
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.TileJSON({
|
||||
url: 'http://api.tiles.mapbox.com/v3/' +
|
||||
'mapbox.natural-earth-hypso-bathy.jsonp',
|
||||
'mapbox.natural-earth-hypso-bathy.json',
|
||||
crossOrigin: 'anonymous'
|
||||
}),
|
||||
minResolution: 2000,
|
||||
|
||||
@@ -4,7 +4,7 @@ title: Full-Screen Mobile
|
||||
shortdesc: Example of a full screen map.
|
||||
tags: "fullscreen, geolocation, mobile"
|
||||
cloak:
|
||||
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
|
||||
---
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
@@ -14,7 +14,7 @@ var map = new ol.Map({
|
||||
layers: [
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.BingMaps({
|
||||
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3',
|
||||
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
|
||||
imagerySet: 'Road'
|
||||
})
|
||||
})
|
||||
|
||||
@@ -54,7 +54,7 @@ var styleFunction = (function() {
|
||||
}),
|
||||
image: image
|
||||
});
|
||||
return function(feature, resolution) {
|
||||
return function(feature) {
|
||||
return styles[feature.getGeometry().getType()] || styles['default'];
|
||||
};
|
||||
})();
|
||||
@@ -67,94 +67,81 @@ var geojsonObject = {
|
||||
'name': 'EPSG:3857'
|
||||
}
|
||||
},
|
||||
'features': [
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Point',
|
||||
'coordinates': [0, 0]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'MultiPoint',
|
||||
'coordinates': [[-2e6, 0], [0, -2e6]]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[4e6, -2e6], [8e6, 2e6], [9e6, 2e6]]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[4e6, -2e6], [8e6, 2e6], [8e6, 3e6]]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[-5e6, -1e6], [-4e6, 1e6],
|
||||
[-3e6, -1e6], [-5e6, -1e6]], [[-4.5e6, -0.5e6],
|
||||
[-3.5e6, -0.5e6], [-4e6, 0.5e6], [-4.5e6, -0.5e6]]]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'MultiLineString',
|
||||
'coordinates': [
|
||||
[[-1e6, -7.5e5], [-1e6, 7.5e5]],
|
||||
[[-1e6, -7.5e5], [-1e6, 7.5e5], [-5e5, 0], [-1e6, -7.5e5]],
|
||||
[[1e6, -7.5e5], [15e5, 0], [15e5, 0], [1e6, 7.5e5]],
|
||||
[[-7.5e5, -1e6], [7.5e5, -1e6]],
|
||||
[[-7.5e5, 1e6], [7.5e5, 1e6]]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'MultiPolygon',
|
||||
'coordinates': [
|
||||
[[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
|
||||
[-3e6, 6e6], [-5e6, 6e6]]],
|
||||
[[[-3e6, 6e6], [-2e6, 8e6], [0, 8e6],
|
||||
[0, 6e6], [-3e6, 6e6]]],
|
||||
[[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
|
||||
[3e6, 6e6], [1e6, 6e6]]]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'GeometryCollection',
|
||||
'geometries': [
|
||||
{
|
||||
'type': 'LineString',
|
||||
'coordinates': [[-5e6, -5e6], [0, -5e6]]
|
||||
},
|
||||
{
|
||||
'type': 'Point',
|
||||
'coordinates': [4e6, -5e6]
|
||||
},
|
||||
{
|
||||
'type': 'Polygon',
|
||||
'coordinates': [
|
||||
[[1e6, -6e6], [2e6, -4e6], [3e6, -6e6], [1e6, -6e6]]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
'features': [{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Point',
|
||||
'coordinates': [0, 0]
|
||||
}
|
||||
]
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'MultiPoint',
|
||||
'coordinates': [[-2e6, 0], [0, -2e6]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[4e6, -2e6], [8e6, 2e6], [9e6, 2e6]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[4e6, -2e6], [8e6, 2e6], [8e6, 3e6]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[-5e6, -1e6], [-4e6, 1e6],
|
||||
[-3e6, -1e6], [-5e6, -1e6]], [[-4.5e6, -0.5e6],
|
||||
[-3.5e6, -0.5e6], [-4e6, 0.5e6], [-4.5e6, -0.5e6]]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'MultiLineString',
|
||||
'coordinates': [
|
||||
[[-1e6, -7.5e5], [-1e6, 7.5e5]],
|
||||
[[-1e6, -7.5e5], [-1e6, 7.5e5], [-5e5, 0], [-1e6, -7.5e5]],
|
||||
[[1e6, -7.5e5], [15e5, 0], [15e5, 0], [1e6, 7.5e5]],
|
||||
[[-7.5e5, -1e6], [7.5e5, -1e6]],
|
||||
[[-7.5e5, 1e6], [7.5e5, 1e6]]
|
||||
]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'MultiPolygon',
|
||||
'coordinates': [
|
||||
[[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
|
||||
[-3e6, 6e6], [-5e6, 6e6]]],
|
||||
[[[-3e6, 6e6], [-2e6, 8e6], [0, 8e6],
|
||||
[0, 6e6], [-3e6, 6e6]]],
|
||||
[[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
|
||||
[3e6, 6e6], [1e6, 6e6]]]
|
||||
]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'GeometryCollection',
|
||||
'geometries': [{
|
||||
'type': 'LineString',
|
||||
'coordinates': [[-5e6, -5e6], [0, -5e6]]
|
||||
}, {
|
||||
'type': 'Point',
|
||||
'coordinates': [4e6, -5e6]
|
||||
}, {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [
|
||||
[[1e6, -6e6], [2e6, -4e6], [3e6, -6e6], [1e6, -6e6]]
|
||||
]
|
||||
}]
|
||||
}
|
||||
}]
|
||||
};
|
||||
|
||||
var source = new ol.source.Vector({
|
||||
@@ -224,7 +211,7 @@ var overlayStyle = (function() {
|
||||
|
||||
styles['GeometryCollection'] = styles['Polygon'].concat(styles['Point']);
|
||||
|
||||
return function(feature, resolution) {
|
||||
return function(feature) {
|
||||
return styles[feature.getGeometry().getType()];
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -10,7 +10,7 @@ goog.require('ol.style.Style');
|
||||
|
||||
|
||||
var format = new ol.format.TopoJSON();
|
||||
var tileGrid = ol.tilegrid.createXYZ({ maxZoom: 19 });
|
||||
var tileGrid = ol.tilegrid.createXYZ({maxZoom: 19});
|
||||
var roadStyleCache = {};
|
||||
var roadColor = {
|
||||
'major_road': '#776',
|
||||
@@ -51,7 +51,7 @@ var map = new ol.Map({
|
||||
url: 'http://{a-c}.tile.openstreetmap.us/' +
|
||||
'vectiles-highroad/{z}/{x}/{y}.topojson'
|
||||
}),
|
||||
style: function(feature, resolution) {
|
||||
style: function(feature) {
|
||||
var kind = feature.get('kind');
|
||||
var railway = feature.get('railway');
|
||||
var sort_key = feature.get('sort_key');
|
||||
@@ -97,7 +97,7 @@ var map = new ol.Map({
|
||||
'vectiles-land-usages/{z}/{x}/{y}.topojson'
|
||||
}),
|
||||
visible: false,
|
||||
style: function(feature, resolution) {
|
||||
style: function(feature) {
|
||||
var kind = feature.get('kind');
|
||||
var styleKey = kind;
|
||||
var style = landuseStyleCache[styleKey];
|
||||
|
||||
@@ -49,40 +49,35 @@ var geojsonObject = {
|
||||
'name': 'EPSG:3857'
|
||||
}
|
||||
},
|
||||
'features': [
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
|
||||
[-3e6, 6e6], [-5e6, 6e6]]]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[-2e6, 6e6], [-2e6, 8e6], [0, 8e6],
|
||||
[0, 6e6], [-2e6, 6e6]]]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
|
||||
[3e6, 6e6], [1e6, 6e6]]]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[-2e6, -1e6], [-1e6, 1e6],
|
||||
[0, -1e6], [-2e6, -1e6]]]
|
||||
}
|
||||
'features': [{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
|
||||
[-3e6, 6e6], [-5e6, 6e6]]]
|
||||
}
|
||||
]
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[-2e6, 6e6], [-2e6, 8e6], [0, 8e6],
|
||||
[0, 6e6], [-2e6, 6e6]]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
|
||||
[3e6, 6e6], [1e6, 6e6]]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[-2e6, -1e6], [-1e6, 1e6],
|
||||
[0, -1e6], [-2e6, -1e6]]]
|
||||
}
|
||||
}]
|
||||
};
|
||||
|
||||
var source = new ol.source.Vector({
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user