columbus3 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/README.md +122 -0
- data/bin/console +0 -0
- data/bin/setup +0 -0
- data/bower.json +25 -0
- data/bower_components/jquery/.bower.json +7 -20
- data/bower_components/jquery/AUTHORS.txt +301 -0
- data/bower_components/jquery/{MIT-LICENSE.txt → LICENSE.txt} +17 -2
- data/bower_components/jquery/README.md +67 -0
- data/bower_components/jquery/bower.json +2 -16
- data/bower_components/jquery/dist/core.js +476 -0
- data/bower_components/jquery/dist/jquery.js +3861 -2818
- data/bower_components/jquery/dist/jquery.min.js +4 -5
- data/bower_components/jquery/dist/jquery.min.map +1 -1
- data/bower_components/jquery/dist/jquery.slim.js +8160 -0
- data/bower_components/jquery/dist/jquery.slim.min.js +4 -0
- data/bower_components/jquery/dist/jquery.slim.min.map +1 -0
- data/bower_components/jquery/external/sizzle/LICENSE.txt +36 -0
- data/bower_components/jquery/{src → external}/sizzle/dist/sizzle.js +445 -240
- data/bower_components/jquery/external/sizzle/dist/sizzle.min.js +3 -0
- data/bower_components/jquery/external/sizzle/dist/sizzle.min.map +1 -0
- data/bower_components/jquery/src/.eslintrc.json +5 -0
- data/bower_components/jquery/src/ajax.js +174 -105
- data/bower_components/jquery/src/ajax/jsonp.js +27 -14
- data/bower_components/jquery/src/ajax/load.js +24 -23
- data/bower_components/jquery/src/ajax/parseXML.js +8 -6
- data/bower_components/jquery/src/ajax/script.js +25 -12
- data/bower_components/jquery/src/ajax/var/location.js +5 -0
- data/bower_components/jquery/src/ajax/var/nonce.js +4 -2
- data/bower_components/jquery/src/ajax/var/rquery.js +5 -3
- data/bower_components/jquery/src/ajax/xhr.js +76 -43
- data/bower_components/jquery/src/attributes.js +4 -2
- data/bower_components/jquery/src/attributes/attr.js +60 -60
- data/bower_components/jquery/src/attributes/classes.js +87 -71
- data/bower_components/jquery/src/attributes/prop.js +81 -32
- data/bower_components/jquery/src/attributes/support.js +11 -13
- data/bower_components/jquery/src/attributes/val.js +66 -37
- data/bower_components/jquery/src/callbacks.js +119 -90
- data/bower_components/jquery/src/core.js +108 -134
- data/bower_components/jquery/src/core/DOMEval.js +16 -0
- data/bower_components/jquery/src/core/access.js +21 -11
- data/bower_components/jquery/src/core/init.js +33 -28
- data/bower_components/jquery/src/core/nodeName.js +13 -0
- data/bower_components/jquery/src/core/parseHTML.js +39 -13
- data/bower_components/jquery/src/core/ready-no-deferred.js +96 -0
- data/bower_components/jquery/src/core/ready.js +40 -51
- data/bower_components/jquery/src/core/readyException.js +13 -0
- data/bower_components/jquery/src/core/stripAndCollapse.js +14 -0
- data/bower_components/jquery/src/core/support.js +20 -0
- data/bower_components/jquery/src/core/var/rsingleTag.js +5 -3
- data/bower_components/jquery/src/css.js +146 -158
- data/bower_components/jquery/src/css/addGetHookIf.js +7 -3
- data/bower_components/jquery/src/css/adjustCSS.js +71 -0
- data/bower_components/jquery/src/css/curCSS.js +22 -14
- data/bower_components/jquery/src/css/hiddenVisibleSelectors.js +8 -8
- data/bower_components/jquery/src/css/showHide.js +105 -0
- data/bower_components/jquery/src/css/support.js +69 -76
- data/bower_components/jquery/src/css/var/cssExpand.js +4 -2
- data/bower_components/jquery/src/css/var/getStyles.js +11 -6
- data/bower_components/jquery/src/css/var/isHiddenWithinTree.js +34 -0
- data/bower_components/jquery/src/css/var/rmargin.js +5 -3
- data/bower_components/jquery/src/css/var/rnumnonpx.js +4 -2
- data/bower_components/jquery/src/css/{swap.js → var/swap.js} +5 -7
- data/bower_components/jquery/src/data.js +67 -66
- data/bower_components/jquery/src/data/Data.js +87 -107
- data/bower_components/jquery/src/data/{accepts.js → var/acceptData.js} +6 -7
- data/bower_components/jquery/src/data/var/{data_priv.js → dataPriv.js} +4 -2
- data/bower_components/jquery/src/data/var/{data_user.js → dataUser.js} +4 -2
- data/bower_components/jquery/src/deferred.js +314 -72
- data/bower_components/jquery/src/deferred/exceptionHook.js +21 -0
- data/bower_components/jquery/src/deprecated.js +36 -9
- data/bower_components/jquery/src/dimensions.js +16 -10
- data/bower_components/jquery/src/effects.js +257 -206
- data/bower_components/jquery/src/effects/Tween.js +18 -9
- data/bower_components/jquery/src/effects/animatedSelector.js +7 -5
- data/bower_components/jquery/src/event.js +297 -419
- data/bower_components/jquery/src/event/ajax.js +13 -4
- data/bower_components/jquery/src/event/alias.js +13 -23
- data/bower_components/jquery/src/event/focusin.js +55 -0
- data/bower_components/jquery/src/event/support.js +5 -3
- data/bower_components/jquery/src/event/trigger.js +185 -0
- data/bower_components/jquery/src/exports/amd.js +5 -3
- data/bower_components/jquery/src/exports/global.js +8 -6
- data/bower_components/jquery/src/jquery.js +6 -2
- data/bower_components/jquery/src/manipulation.js +218 -310
- data/bower_components/jquery/src/manipulation/_evalUrl.js +9 -4
- data/bower_components/jquery/src/manipulation/buildFragment.js +104 -0
- data/bower_components/jquery/src/manipulation/getAll.js +32 -0
- data/bower_components/jquery/src/manipulation/setGlobalEval.js +22 -0
- data/bower_components/jquery/src/manipulation/support.js +11 -8
- data/bower_components/jquery/src/manipulation/var/rcheckableType.js +5 -3
- data/bower_components/jquery/src/manipulation/var/rscriptType.js +5 -0
- data/bower_components/jquery/src/manipulation/var/rtagName.js +5 -0
- data/bower_components/jquery/src/manipulation/wrapMap.js +29 -0
- data/bower_components/jquery/src/offset.js +75 -53
- data/bower_components/jquery/src/queue.js +26 -23
- data/bower_components/jquery/src/queue/delay.js +8 -6
- data/bower_components/jquery/src/selector-native.js +133 -68
- data/bower_components/jquery/src/selector-sizzle.js +10 -5
- data/bower_components/jquery/src/selector.js +3 -1
- data/bower_components/jquery/src/serialize.js +52 -33
- data/bower_components/jquery/src/traversing.js +61 -69
- data/bower_components/jquery/src/traversing/findFilter.js +37 -31
- data/bower_components/jquery/src/traversing/var/dir.js +22 -0
- data/bower_components/jquery/src/traversing/var/rneedsContext.js +4 -2
- data/bower_components/jquery/src/traversing/var/siblings.js +17 -0
- data/bower_components/jquery/src/var/ObjectFunctionString.js +7 -0
- data/bower_components/jquery/src/var/arr.js +4 -2
- data/bower_components/jquery/src/var/class2type.js +4 -2
- data/bower_components/jquery/src/var/concat.js +4 -2
- data/bower_components/jquery/src/var/document.js +5 -0
- data/bower_components/jquery/src/var/documentElement.js +7 -0
- data/bower_components/jquery/src/var/fnToString.js +7 -0
- data/bower_components/jquery/src/var/getProto.js +5 -0
- data/bower_components/jquery/src/var/hasOwn.js +4 -2
- data/bower_components/jquery/src/var/indexOf.js +4 -2
- data/bower_components/jquery/src/var/pnum.js +5 -3
- data/bower_components/jquery/src/var/push.js +4 -2
- data/bower_components/jquery/src/var/rcssNum.js +9 -0
- data/bower_components/jquery/src/var/rnothtmlwhite.js +8 -0
- data/bower_components/jquery/src/var/slice.js +4 -2
- data/bower_components/jquery/src/var/support.js +4 -2
- data/bower_components/jquery/src/var/toString.js +4 -2
- data/bower_components/jquery/src/wrap.js +24 -26
- data/bower_components/leaflet-providers/.bower.json +6 -7
- data/bower_components/leaflet-providers/CHANGELOG.md +62 -0
- data/bower_components/leaflet-providers/README.md +12 -3
- data/bower_components/leaflet-providers/bower.json +1 -1
- data/bower_components/leaflet-providers/leaflet-providers.js +133 -92
- data/bower_components/leaflet-providers/package.json +14 -7
- data/bower_components/leaflet/.bower.json +10 -14
- data/bower_components/leaflet/CHANGELOG.md +648 -3
- data/bower_components/leaflet/CONTRIBUTING.md +88 -33
- data/bower_components/leaflet/ISSUE_TEMPLATE.md +25 -0
- data/bower_components/leaflet/Jakefile.js +73 -14
- data/bower_components/leaflet/LICENSE +1 -1
- data/bower_components/leaflet/PLUGIN-GUIDE.md +97 -3
- data/bower_components/leaflet/README.md +6 -8
- data/bower_components/leaflet/bower.json +3 -9
- data/bower_components/leaflet/dist/images/layers-2x.png +0 -0
- data/bower_components/leaflet/dist/images/layers.png +0 -0
- data/bower_components/leaflet/dist/images/marker-icon-2x.png +0 -0
- data/bower_components/leaflet/dist/images/marker-icon.png +0 -0
- data/bower_components/leaflet/dist/images/marker-shadow.png +0 -0
- data/bower_components/leaflet/dist/leaflet-src.js +12301 -7898
- data/bower_components/leaflet/dist/leaflet-src.js.map +1 -0
- data/bower_components/leaflet/dist/leaflet.css +196 -43
- data/bower_components/leaflet/dist/leaflet.js +6 -9
- data/bower_components/leaflet/dist/leaflet.js.map +1 -0
- data/bower_components/leaflet/docs/CNAME +1 -0
- data/bower_components/leaflet/docs/Gemfile +4 -0
- data/bower_components/leaflet/docs/_config.yml +19 -0
- data/bower_components/leaflet/docs/_includes/frame.html +9 -0
- data/bower_components/leaflet/docs/_includes/tutorial_link.html +8 -0
- data/bower_components/leaflet/docs/_layouts/post.html +30 -0
- data/bower_components/leaflet/docs/_layouts/redirected.html +14 -0
- data/bower_components/leaflet/docs/_layouts/tutorial.html +9 -0
- data/bower_components/leaflet/docs/_layouts/tutorial_frame.html +32 -0
- data/bower_components/leaflet/docs/_layouts/tutorial_v2.html +9 -0
- data/bower_components/leaflet/docs/_layouts/v2.html +159 -0
- data/bower_components/leaflet/docs/_posts/2012-07-30-leaflet-0-4-released.md +240 -0
- data/bower_components/leaflet/docs/_posts/2012-08-07-leaflet-0-4-3-and-a-new-tutorial.md +47 -0
- data/bower_components/leaflet/docs/_posts/2012-08-20-guest-post-markerclusterer-0-1-released.md +112 -0
- data/bower_components/leaflet/docs/_posts/2012-10-25-leaflet-0-4-5-bugfix-release-and-plans-for-0.5.md +36 -0
- data/bower_components/leaflet/docs/_posts/2013-01-17-leaflet-0-5-released.md +24 -0
- data/bower_components/leaflet/docs/_posts/2013-02-20-guest-post-draw.md +146 -0
- data/bower_components/leaflet/docs/_posts/2013-06-26-leaflet-0-6-released-dc-code-sprint-mapbox.md +31 -0
- data/bower_components/leaflet/docs/_posts/2013-06-28-leaflet-plugin-authoring-guide.md +111 -0
- data/bower_components/leaflet/docs/_posts/2013-11-18-leaflet-0-7-released-plans-for-future.md +56 -0
- data/bower_components/leaflet/docs/_posts/2015-07-01-leaflet-is-alive-and-kicking.md +21 -0
- data/bower_components/leaflet/docs/_posts/2015-07-15-leaflet-1.0-beta1-released.md +60 -0
- data/bower_components/leaflet/docs/_posts/2015-09-01-leaflet-0.7.4-released.md +29 -0
- data/bower_components/leaflet/docs/_posts/2015-10-14-leaflet-1.0-beta2-released.md +35 -0
- data/bower_components/leaflet/docs/_posts/2016-03-20-debugging-touch-interactions.md +101 -0
- data/bower_components/leaflet/docs/_posts/2016-04-18-leaflet-1.0-rc1.md +78 -0
- data/bower_components/leaflet/docs/_posts/2016-07-16-leaflet-1.0-rc2.md +60 -0
- data/bower_components/leaflet/docs/_posts/2016-08-05-leaflet-1.0-rc3.md +53 -0
- data/bower_components/leaflet/docs/_posts/2016-09-27-leaflet-1.0-final.md +50 -0
- data/bower_components/leaflet/docs/_posts/2016-11-21-leaflet-1.0.2.md +25 -0
- data/bower_components/leaflet/docs/_posts/2017-01-23-leaflet-1.0.3.md +27 -0
- data/bower_components/leaflet/docs/atom.xml +29 -0
- data/bower_components/leaflet/docs/blog.md +24 -0
- data/bower_components/leaflet/docs/docs/css/main.css +1092 -0
- data/bower_components/leaflet/docs/docs/css/normalize.css +426 -0
- data/bower_components/leaflet/docs/docs/highlight/LICENSE +24 -0
- data/bower_components/leaflet/docs/docs/highlight/highlight.pack.js +1 -0
- data/bower_components/leaflet/docs/docs/highlight/styles/github-gist.css +211 -0
- data/bower_components/leaflet/docs/docs/images/2016-03-20-prosthetic-hand-zooming.gif +0 -0
- data/bower_components/leaflet/docs/docs/images/2016-04-18-inheritances.gif +0 -0
- data/bower_components/leaflet/docs/docs/images/2016-04-18-leaflet-toilet-paper.jpeg +0 -0
- data/bower_components/leaflet/docs/docs/images/2016-04-18-madrid-leaflet-864px.jpg +0 -0
- data/bower_components/leaflet/docs/docs/images/2016-07-18-remote-session.png +0 -0
- data/bower_components/leaflet/docs/docs/images/2016-07-18-tooltip.png +0 -0
- data/bower_components/leaflet/docs/docs/images/2016-08-03-iraq-hacking.jpg +0 -0
- data/bower_components/leaflet/docs/docs/images/favicon.ico +0 -0
- data/bower_components/leaflet/docs/docs/images/forum-round.png +0 -0
- data/bower_components/leaflet/docs/docs/images/github-round.png +0 -0
- data/bower_components/leaflet/docs/docs/images/logo.png +0 -0
- data/bower_components/leaflet/docs/docs/images/logos.png +0 -0
- data/bower_components/leaflet/docs/docs/images/sprite.png +0 -0
- data/bower_components/leaflet/docs/docs/images/sprite.svg +75 -0
- data/bower_components/leaflet/docs/docs/images/twitter-round.png +0 -0
- data/bower_components/leaflet/docs/docs/images/twitter.png +0 -0
- data/bower_components/leaflet/docs/docs/js/docs.js +52 -0
- data/bower_components/leaflet/docs/download.md +95 -0
- data/bower_components/leaflet/docs/examples.md +125 -0
- data/bower_components/leaflet/docs/examples/choropleth-example.md +5 -0
- data/bower_components/leaflet/docs/examples/choropleth.md +5 -0
- data/bower_components/leaflet/docs/examples/choropleth/example-basic.md +20 -0
- data/bower_components/leaflet/docs/examples/choropleth/example-color.md +46 -0
- data/bower_components/leaflet/docs/examples/choropleth/example.md +159 -0
- data/bower_components/leaflet/docs/examples/choropleth/index.md +232 -0
- data/bower_components/leaflet/docs/examples/choropleth/thumbnail.png +0 -0
- data/bower_components/leaflet/docs/examples/choropleth/us-states.js +54 -0
- data/bower_components/leaflet/docs/examples/crs-simple/crs-simple-example1.md +16 -0
- data/bower_components/leaflet/docs/examples/crs-simple/crs-simple-example2.md +20 -0
- data/bower_components/leaflet/docs/examples/crs-simple/crs-simple-example3.md +38 -0
- data/bower_components/leaflet/docs/examples/crs-simple/crs-simple.md +117 -0
- data/bower_components/leaflet/docs/examples/crs-simple/thumbnail.png +0 -0
- data/bower_components/leaflet/docs/examples/crs-simple/uqm_map_400px.png +0 -0
- data/bower_components/leaflet/docs/examples/crs-simple/uqm_map_detail.png +0 -0
- data/bower_components/leaflet/docs/examples/crs-simple/uqm_map_full.png +0 -0
- data/bower_components/leaflet/docs/examples/custom-icons-example.md +5 -0
- data/bower_components/leaflet/docs/examples/custom-icons.md +5 -0
- data/bower_components/leaflet/docs/examples/custom-icons/example-one-icon.md +27 -0
- data/bower_components/leaflet/docs/examples/custom-icons/example.md +31 -0
- data/bower_components/leaflet/docs/examples/custom-icons/index.md +79 -0
- data/bower_components/leaflet/docs/examples/custom-icons/leaf-green.png +0 -0
- data/bower_components/leaflet/docs/examples/custom-icons/leaf-orange.png +0 -0
- data/bower_components/leaflet/docs/examples/custom-icons/leaf-red.png +0 -0
- data/bower_components/leaflet/docs/examples/custom-icons/leaf-shadow.png +0 -0
- data/bower_components/leaflet/docs/examples/custom-icons/thumbnail.png +0 -0
- data/bower_components/leaflet/docs/examples/extending/canvascircles.md +37 -0
- data/bower_components/leaflet/docs/examples/extending/class-diagram.md +24 -0
- data/bower_components/leaflet/docs/examples/extending/class-diagram.png +0 -0
- data/bower_components/leaflet/docs/examples/extending/class-diagram.txt +100 -0
- data/bower_components/leaflet/docs/examples/extending/extending-1-classes.md +196 -0
- data/bower_components/leaflet/docs/examples/extending/extending-2-layers.md +210 -0
- data/bower_components/leaflet/docs/examples/extending/extending-3-controls.md +100 -0
- data/bower_components/leaflet/docs/examples/extending/gridcoords.md +32 -0
- data/bower_components/leaflet/docs/examples/extending/kittenlayer.md +29 -0
- data/bower_components/leaflet/docs/examples/extending/pixelorigin.md +90 -0
- data/bower_components/leaflet/docs/examples/extending/thumbnail-1.png +0 -0
- data/bower_components/leaflet/docs/examples/extending/thumbnail-2.png +0 -0
- data/bower_components/leaflet/docs/examples/extending/thumbnail-3.png +0 -0
- data/bower_components/leaflet/docs/examples/extending/tilt.md +59 -0
- data/bower_components/leaflet/docs/examples/extending/watermark.md +36 -0
- data/bower_components/leaflet/docs/examples/geojson-example.md +5 -0
- data/bower_components/leaflet/docs/examples/geojson.md +5 -0
- data/bower_components/leaflet/docs/examples/geojson/baseball-marker.png +0 -0
- data/bower_components/leaflet/docs/examples/geojson/example.md +78 -0
- data/bower_components/leaflet/docs/examples/geojson/geojson-example.html +89 -0
- data/bower_components/leaflet/docs/examples/geojson/geojson.html +281 -0
- data/bower_components/leaflet/docs/examples/geojson/index.md +205 -0
- data/bower_components/leaflet/docs/examples/geojson/sample-geojson.js +248 -0
- data/bower_components/leaflet/docs/examples/geojson/thumbnail.png +0 -0
- data/bower_components/leaflet/docs/examples/layers-control-example.md +5 -0
- data/bower_components/leaflet/docs/examples/layers-control.md +5 -0
- data/bower_components/leaflet/docs/examples/layers-control/example.md +38 -0
- data/bower_components/leaflet/docs/examples/layers-control/index.md +72 -0
- data/bower_components/leaflet/docs/examples/layers-control/thumbnail.png +0 -0
- data/bower_components/leaflet/docs/examples/map-panes-example.md +5 -0
- data/bower_components/leaflet/docs/examples/map-panes.md +5 -0
- data/bower_components/leaflet/docs/examples/map-panes/eu-countries.js +79 -0
- data/bower_components/leaflet/docs/examples/map-panes/example.md +38 -0
- data/bower_components/leaflet/docs/examples/map-panes/index.md +105 -0
- data/bower_components/leaflet/docs/examples/map-panes/thumbnail.png +0 -0
- data/bower_components/leaflet/docs/examples/mobile-example.md +5 -0
- data/bower_components/leaflet/docs/examples/mobile.md +5 -0
- data/bower_components/leaflet/docs/examples/mobile/example.md +42 -0
- data/bower_components/leaflet/docs/examples/mobile/index.md +72 -0
- data/bower_components/leaflet/docs/examples/mobile/thumbnail.png +0 -0
- data/bower_components/leaflet/docs/examples/quick-start-example.md +5 -0
- data/bower_components/leaflet/docs/examples/quick-start.md +5 -0
- data/bower_components/leaflet/docs/examples/quick-start/example-basic.md +19 -0
- data/bower_components/leaflet/docs/examples/quick-start/example-overlays.md +35 -0
- data/bower_components/leaflet/docs/examples/quick-start/example-popups.md +37 -0
- data/bower_components/leaflet/docs/examples/quick-start/example.md +46 -0
- data/bower_components/leaflet/docs/examples/quick-start/index.md +143 -0
- data/bower_components/leaflet/docs/examples/quick-start/thumbnail.png +0 -0
- data/bower_components/leaflet/docs/examples/video-overlay/example-bounds.md +23 -0
- data/bower_components/leaflet/docs/examples/video-overlay/example-nocontrols.md +31 -0
- data/bower_components/leaflet/docs/examples/video-overlay/example.md +58 -0
- data/bower_components/leaflet/docs/examples/video-overlay/index.md +122 -0
- data/bower_components/leaflet/docs/examples/video-overlay/thumbnail.gif +0 -0
- data/bower_components/leaflet/docs/examples/wms/qgis-wms-layers.png +0 -0
- data/bower_components/leaflet/docs/examples/wms/thumbnail.png +0 -0
- data/bower_components/leaflet/docs/examples/wms/wms-example-crs.md +18 -0
- data/bower_components/leaflet/docs/examples/wms/wms-example1.md +16 -0
- data/bower_components/leaflet/docs/examples/wms/wms-example2.md +16 -0
- data/bower_components/leaflet/docs/examples/wms/wms-example3.md +34 -0
- data/bower_components/leaflet/docs/examples/wms/wms-example4.md +29 -0
- data/bower_components/leaflet/docs/examples/wms/wms.md +157 -0
- data/bower_components/leaflet/docs/examples/zoom-levels/example-delta.md +40 -0
- data/bower_components/leaflet/docs/examples/zoom-levels/example-fractional.md +56 -0
- data/bower_components/leaflet/docs/examples/zoom-levels/example-scale.md +29 -0
- data/bower_components/leaflet/docs/examples/zoom-levels/example-setzoom.md +44 -0
- data/bower_components/leaflet/docs/examples/zoom-levels/example-zero.md +19 -0
- data/bower_components/leaflet/docs/examples/zoom-levels/index.md +275 -0
- data/bower_components/leaflet/docs/examples/zoom-levels/thumbnail.png +0 -0
- data/bower_components/leaflet/docs/index.html +218 -0
- data/bower_components/leaflet/docs/plugins.md +3854 -0
- data/bower_components/leaflet/docs/reference-0.7.7.html +6424 -0
- data/bower_components/leaflet/docs/reference-1.0.0.html +22889 -0
- data/bower_components/leaflet/docs/reference-1.0.2.html +23382 -0
- data/bower_components/leaflet/docs/reference-1.0.3.html +23495 -0
- data/bower_components/leaflet/docs/reference-tpl.html +89 -0
- data/bower_components/leaflet/docs/reference-versions.html +16 -0
- data/bower_components/leaflet/docs/reference.html +3 -0
- data/bower_components/leaflet/package.json +77 -16
- data/columbus3.gemspec +1 -1
- data/doc/ChangeLog.org +10 -0
- data/doc/manual.txt +122 -0
- data/doc/todo.org +63 -0
- data/exe/columbus3 +2 -246
- data/lib/columbus3.rb +12 -7
- data/lib/columbus3/cli/command_semantics.rb +352 -0
- data/lib/columbus3/cli/command_syntax.rb +103 -0
- data/lib/columbus3/metadata/query_parser.racc +21 -7
- data/lib/columbus3/metadata/query_parser.tab.rb +34 -34
- data/lib/columbus3/metadata/sidecar.rb +1 -1
- data/lib/columbus3/renderer/flot_renderer.rb +3 -8
- data/lib/columbus3/renderer/leaflet_renderer.rb +18 -29
- data/lib/columbus3/renderer/sanitizer.rb +8 -0
- data/lib/columbus3/v900track/gpx2v900.rb +31 -0
- data/lib/columbus3/v900track/v900track.rb +34 -8
- data/lib/columbus3/v900track/v900waypoint.rb +9 -0
- data/lib/columbus3/version.rb +1 -1
- data/lib/html/flot.html.erb +6 -6
- data/lib/html/show.html.erb +53 -76
- data/lib/html/track.js.erb +58 -12
- metadata +222 -23
- data/README.textile +0 -67
- data/bower_components/jquery/src/ajax/parseJSON.js +0 -13
- data/bower_components/jquery/src/css/defaultDisplay.js +0 -70
- data/bower_components/jquery/src/css/var/isHidden.js +0 -13
- data/bower_components/jquery/src/intro.js +0 -44
- data/bower_components/jquery/src/outro.js +0 -1
- data/bower_components/jquery/src/sizzle/dist/sizzle.min.js +0 -3
- data/bower_components/jquery/src/sizzle/dist/sizzle.min.map +0 -1
- data/bower_components/jquery/src/var/rnotwhite.js +0 -3
- data/bower_components/jquery/src/var/strundefined.js +0 -3
- data/bower_components/leaflet/component.json +0 -20
@@ -0,0 +1,89 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Leaflet GeoJSON Example</title>
|
5
|
+
<meta charset="utf-8" />
|
6
|
+
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
8
|
+
|
9
|
+
<link rel="stylesheet" href="https://unpkg.com/leaflet@{{ site.latest_leaflet_version}}/dist/leaflet.css" integrity="{{site.integrity_hash_css}}" crossorigin=""/>
|
10
|
+
<script src="https://unpkg.com/leaflet@{{ site.latest_leaflet_version}}/dist/leaflet.js" integrity="{{site.integrity_hash_uglified}}" crossorigin=""></script></head>
|
11
|
+
<body>
|
12
|
+
<div id="map" style="width: 600px; height: 400px"></div>
|
13
|
+
|
14
|
+
<script src="sample-geojson.js"></script>
|
15
|
+
|
16
|
+
<script>
|
17
|
+
var map = L.map('map').setView([39.74739, -105], 13);
|
18
|
+
|
19
|
+
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
|
20
|
+
maxZoom: 18,
|
21
|
+
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
|
22
|
+
'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
|
23
|
+
'Imagery © <a href="http://mapbox.com">Mapbox</a>',
|
24
|
+
id: 'mapbox.light'
|
25
|
+
}).addTo(map);
|
26
|
+
|
27
|
+
var baseballIcon = L.icon({
|
28
|
+
iconUrl: 'baseball-marker.png',
|
29
|
+
iconSize: [32, 37],
|
30
|
+
iconAnchor: [16, 37],
|
31
|
+
popupAnchor: [0, -28]
|
32
|
+
});
|
33
|
+
|
34
|
+
function onEachFeature(feature, layer) {
|
35
|
+
var popupContent = "<p>I started out as a GeoJSON " +
|
36
|
+
feature.geometry.type + ", but now I'm a Leaflet vector!</p>";
|
37
|
+
|
38
|
+
if (feature.properties && feature.properties.popupContent) {
|
39
|
+
popupContent += feature.properties.popupContent;
|
40
|
+
}
|
41
|
+
|
42
|
+
layer.bindPopup(popupContent);
|
43
|
+
}
|
44
|
+
|
45
|
+
L.geoJson([bicycleRental, campus], {
|
46
|
+
|
47
|
+
style: function (feature) {
|
48
|
+
return feature.properties && feature.properties.style;
|
49
|
+
},
|
50
|
+
|
51
|
+
onEachFeature: onEachFeature,
|
52
|
+
|
53
|
+
pointToLayer: function (feature, latlng) {
|
54
|
+
return L.circleMarker(latlng, {
|
55
|
+
radius: 8,
|
56
|
+
fillColor: "#ff7800",
|
57
|
+
color: "#000",
|
58
|
+
weight: 1,
|
59
|
+
opacity: 1,
|
60
|
+
fillOpacity: 0.8
|
61
|
+
});
|
62
|
+
}
|
63
|
+
}).addTo(map);
|
64
|
+
|
65
|
+
L.geoJson(freeBus, {
|
66
|
+
|
67
|
+
filter: function (feature, layer) {
|
68
|
+
if (feature.properties) {
|
69
|
+
// If the property "underConstruction" exists and is true, return false (don't render features under construction)
|
70
|
+
return feature.properties.underConstruction !== undefined ? !feature.properties.underConstruction : true;
|
71
|
+
}
|
72
|
+
return false;
|
73
|
+
},
|
74
|
+
|
75
|
+
onEachFeature: onEachFeature
|
76
|
+
}).addTo(map);
|
77
|
+
|
78
|
+
var coorsLayer = L.geoJson(coorsField, {
|
79
|
+
|
80
|
+
pointToLayer: function (feature, latlng) {
|
81
|
+
return L.marker(latlng, {icon: baseballIcon});
|
82
|
+
},
|
83
|
+
|
84
|
+
onEachFeature: onEachFeature
|
85
|
+
}).addTo(map);
|
86
|
+
|
87
|
+
</script>
|
88
|
+
</body>
|
89
|
+
</html>
|
@@ -0,0 +1,281 @@
|
|
1
|
+
---
|
2
|
+
layout: tutorial
|
3
|
+
title: Using GeoJSON with Leaflet
|
4
|
+
---
|
5
|
+
|
6
|
+
<h3>Using GeoJSON with Leaflet</h3>
|
7
|
+
|
8
|
+
<p>GeoJSON is becoming a very popular data format among many GIS technologies and services — it's simple, lightweight, straightforward, and Leaflet is quite good at handling it. In this example, you'll learn how to create and interact with map vectors created from <a href="http://geojson.org/">GeoJSON</a> objects.</p>
|
9
|
+
|
10
|
+
<div id="map" class="map" style="height: 250px"></div>
|
11
|
+
|
12
|
+
<script src="sample-geojson.js"></script>
|
13
|
+
<script>
|
14
|
+
|
15
|
+
var map = L.map('map').setView([39.74739, -105], 13);
|
16
|
+
|
17
|
+
L.tileLayer(MB_URL, {
|
18
|
+
attribution: MB_ATTR,
|
19
|
+
id: 'mapbox.light'
|
20
|
+
}).addTo(map);
|
21
|
+
|
22
|
+
var baseballIcon = L.icon({
|
23
|
+
iconUrl: 'baseball-marker.png',
|
24
|
+
iconSize: [32, 37],
|
25
|
+
iconAnchor: [16, 37],
|
26
|
+
popupAnchor: [0, -28]
|
27
|
+
});
|
28
|
+
|
29
|
+
function onEachFeature(feature, layer) {
|
30
|
+
var popupContent = "<p>I started out as a GeoJSON " +
|
31
|
+
feature.geometry.type + ", but now I'm a Leaflet vector!</p>";
|
32
|
+
|
33
|
+
if (feature.properties && feature.properties.popupContent) {
|
34
|
+
popupContent += feature.properties.popupContent;
|
35
|
+
}
|
36
|
+
|
37
|
+
layer.bindPopup(popupContent);
|
38
|
+
}
|
39
|
+
|
40
|
+
L.geoJson({features: [bicycleRental, campus]}, {
|
41
|
+
|
42
|
+
style: function (feature) {
|
43
|
+
return feature.properties && feature.properties.style;
|
44
|
+
},
|
45
|
+
|
46
|
+
onEachFeature: onEachFeature,
|
47
|
+
|
48
|
+
pointToLayer: function (feature, latlng) {
|
49
|
+
return L.circleMarker(latlng, {
|
50
|
+
radius: 8,
|
51
|
+
fillColor: "#ff7800",
|
52
|
+
color: "#000",
|
53
|
+
weight: 1,
|
54
|
+
opacity: 1,
|
55
|
+
fillOpacity: 0.8
|
56
|
+
});
|
57
|
+
}
|
58
|
+
}).addTo(map);
|
59
|
+
|
60
|
+
L.geoJson(freeBus, {
|
61
|
+
|
62
|
+
filter: function (feature, layer) {
|
63
|
+
if (feature.properties) {
|
64
|
+
// If the property "underConstruction" exists and is true, return false (don't render features under construction)
|
65
|
+
return feature.properties.underConstruction !== undefined ? !feature.properties.underConstruction : true;
|
66
|
+
}
|
67
|
+
return false;
|
68
|
+
},
|
69
|
+
|
70
|
+
onEachFeature: onEachFeature
|
71
|
+
}).addTo(map);
|
72
|
+
|
73
|
+
var coorsLayer = L.geoJson(null, {
|
74
|
+
|
75
|
+
pointToLayer: function (feature, latlng) {
|
76
|
+
return L.marker(latlng, {icon: baseballIcon});
|
77
|
+
},
|
78
|
+
|
79
|
+
onEachFeature: onEachFeature
|
80
|
+
}).addTo(map);
|
81
|
+
|
82
|
+
coorsLayer.addData(coorsField);
|
83
|
+
|
84
|
+
</script>
|
85
|
+
|
86
|
+
<p><a href="geojson-example.html">View example on a separate page →</a></p>
|
87
|
+
|
88
|
+
<h3>About GeoJSON</h3>
|
89
|
+
|
90
|
+
<p>According to <a href="http://geojson.org">http://geojson.org</a>:</p>
|
91
|
+
|
92
|
+
<blockquote>GeoJSON is a format for encoding a variety of geographic data structures. A GeoJSON object may represent a geometry, a feature, or a collection of features. GeoJSON supports the following geometry types: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection. Features in GeoJSON contain a geometry object and additional properties, and a feature collection represents a list of features.</blockquote>
|
93
|
+
|
94
|
+
<p>Leaflet supports all of the GeoJSON types above, but <a href="http://geojson.org/geojson-spec.html#feature-objects">Features</a> and <a href="http://geojson.org/geojson-spec.html#feature-collection-objects">FeatureCollections</a> work best as they allow you to describe features with a set of properties. We can even use these properties to style our Leaflet vectors. Here's an example of a simple GeoJSON feature:</p>
|
95
|
+
|
96
|
+
<pre><code>var geojsonFeature = {
|
97
|
+
"type": "Feature",
|
98
|
+
"properties": {
|
99
|
+
"name": "Coors Field",
|
100
|
+
"amenity": "Baseball Stadium",
|
101
|
+
"popupContent": "This is where the Rockies play!"
|
102
|
+
},
|
103
|
+
"geometry": {
|
104
|
+
"type": "Point",
|
105
|
+
"coordinates": [-104.99404, 39.75621]
|
106
|
+
}
|
107
|
+
};
|
108
|
+
</code></pre>
|
109
|
+
|
110
|
+
<h3>The GeoJSON layer</h3>
|
111
|
+
|
112
|
+
<p>GeoJSON objects are added to the map through a <a href="http://leafletjs.com/reference.html#geojson">GeoJSON layer</a>. To create it and add it to a map, we can use the following code:</p>
|
113
|
+
|
114
|
+
<pre><code>L.geoJson(geojsonFeature).addTo(map);</code></pre>
|
115
|
+
|
116
|
+
<p>GeoJSON objects may also be passed as an array of valid GeoJSON objects.</p>
|
117
|
+
|
118
|
+
<pre><code>var myLines = [{
|
119
|
+
"type": "LineString",
|
120
|
+
"coordinates": [[-100, 40], [-105, 45], [-110, 55]]
|
121
|
+
}, {
|
122
|
+
"type": "LineString",
|
123
|
+
"coordinates": [[-105, 40], [-110, 45], [-115, 55]]
|
124
|
+
}];
|
125
|
+
</code></pre>
|
126
|
+
|
127
|
+
<p>Alternatively, we could create an empty GeoJSON layer and assign it to a variable so that we can add more features to it later.</p>
|
128
|
+
|
129
|
+
<pre><code>var myLayer = L.geoJson().addTo(map);
|
130
|
+
myLayer.addData(geojsonFeature);
|
131
|
+
</code></pre>
|
132
|
+
|
133
|
+
<h3>Options</h3>
|
134
|
+
|
135
|
+
<h4>style</h4>
|
136
|
+
|
137
|
+
<p>The <code>style</code> option can be used to style features two different ways. First, we can pass a simple object that styles all paths (polylines and polygons) the same way:</p>
|
138
|
+
|
139
|
+
<pre><code>var myLines = [{
|
140
|
+
"type": "LineString",
|
141
|
+
"coordinates": [[-100, 40], [-105, 45], [-110, 55]]
|
142
|
+
}, {
|
143
|
+
"type": "LineString",
|
144
|
+
"coordinates": [[-105, 40], [-110, 45], [-115, 55]]
|
145
|
+
}];
|
146
|
+
|
147
|
+
var myStyle = {
|
148
|
+
"color": "#ff7800",
|
149
|
+
"weight": 5,
|
150
|
+
"opacity": 0.65
|
151
|
+
};
|
152
|
+
|
153
|
+
L.geoJson(myLines, {
|
154
|
+
style: myStyle
|
155
|
+
}).addTo(map);</code></pre>
|
156
|
+
|
157
|
+
<p>Alternatively, we can pass a function that styles individual features based on their properties. In the example below we check the "party" property and style our polygons accordingly:</p>
|
158
|
+
|
159
|
+
<pre><code>var states = [{
|
160
|
+
"type": "Feature",
|
161
|
+
"properties": {"party": "Republican"},
|
162
|
+
"geometry": {
|
163
|
+
"type": "Polygon",
|
164
|
+
"coordinates": [[
|
165
|
+
[-104.05, 48.99],
|
166
|
+
[-97.22, 48.98],
|
167
|
+
[-96.58, 45.94],
|
168
|
+
[-104.03, 45.94],
|
169
|
+
[-104.05, 48.99]
|
170
|
+
]]
|
171
|
+
}
|
172
|
+
}, {
|
173
|
+
"type": "Feature",
|
174
|
+
"properties": {"party": "Democrat"},
|
175
|
+
"geometry": {
|
176
|
+
"type": "Polygon",
|
177
|
+
"coordinates": [[
|
178
|
+
[-109.05, 41.00],
|
179
|
+
[-102.06, 40.99],
|
180
|
+
[-102.03, 36.99],
|
181
|
+
[-109.04, 36.99],
|
182
|
+
[-109.05, 41.00]
|
183
|
+
]]
|
184
|
+
}
|
185
|
+
}];
|
186
|
+
|
187
|
+
L.geoJson(states, {
|
188
|
+
style: function(feature) {
|
189
|
+
switch (feature.properties.party) {
|
190
|
+
case 'Republican': return {color: "#ff0000"};
|
191
|
+
case 'Democrat': return {color: "#0000ff"};
|
192
|
+
}
|
193
|
+
}
|
194
|
+
}).addTo(map);</code></pre>
|
195
|
+
|
196
|
+
<h4>pointToLayer</h4>
|
197
|
+
|
198
|
+
<p>Points are handled differently than polylines and polygons. By default simple markers are drawn for GeoJSON Points. We can alter this by passing a <code>pointToLayer</code> function in a <a href="http://leafletjs.com/reference.html#geojson-options">GeoJSON options</a> object when creating the GeoJSON layer. This function is passed a <a href="http://leafletjs.com/reference.html#latlng">LatLng</a> and should return an instance of ILayer, in this case likely a <a href="http://leafletjs.com/reference.html#marker">Marker</a> or <a href="http://leafletjs.com/reference.html#circlemarker">CircleMarker</a>.</p>
|
199
|
+
|
200
|
+
<p>Here we're using the <code>pointToLayer</code> option to create a CircleMarker:</p>
|
201
|
+
|
202
|
+
<pre><code>var geojsonMarkerOptions = {
|
203
|
+
radius: 8,
|
204
|
+
fillColor: "#ff7800",
|
205
|
+
color: "#000",
|
206
|
+
weight: 1,
|
207
|
+
opacity: 1,
|
208
|
+
fillOpacity: 0.8
|
209
|
+
};
|
210
|
+
|
211
|
+
L.geoJson(someGeojsonFeature, {
|
212
|
+
pointToLayer: function (feature, latlng) {
|
213
|
+
return L.circleMarker(latlng, geojsonMarkerOptions);
|
214
|
+
}
|
215
|
+
}).addTo(map);</code></pre>
|
216
|
+
|
217
|
+
<p>We could also set the <code>style</code> property in this example — Leaflet is smart enough to apply styles to GeoJSON points if you create a vector layer like circle inside the <code>pointToLayer</code> function.</p>
|
218
|
+
|
219
|
+
<h4>onEachFeature</h4>
|
220
|
+
|
221
|
+
<p>The <code>onEachFeature</code> option is a function that gets called on each feature before adding it to a GeoJSON layer. A common reason to use this option is to attach a popup to features when they are clicked.</p>
|
222
|
+
|
223
|
+
<pre><code>function onEachFeature(feature, layer) {
|
224
|
+
// does this feature have a property named popupContent?
|
225
|
+
if (feature.properties && feature.properties.popupContent) {
|
226
|
+
layer.bindPopup(feature.properties.popupContent);
|
227
|
+
}
|
228
|
+
}
|
229
|
+
|
230
|
+
var geojsonFeature = {
|
231
|
+
"type": "Feature",
|
232
|
+
"properties": {
|
233
|
+
"name": "Coors Field",
|
234
|
+
"amenity": "Baseball Stadium",
|
235
|
+
"popupContent": "This is where the Rockies play!"
|
236
|
+
},
|
237
|
+
"geometry": {
|
238
|
+
"type": "Point",
|
239
|
+
"coordinates": [-104.99404, 39.75621]
|
240
|
+
}
|
241
|
+
};
|
242
|
+
|
243
|
+
L.geoJson(geojsonFeature, {
|
244
|
+
onEachFeature: onEachFeature
|
245
|
+
}).addTo(map);</code></pre>
|
246
|
+
|
247
|
+
<h4>filter</h4>
|
248
|
+
|
249
|
+
<p>The <code>filter</code> option can be used to control the visibility of GeoJSON features. To accomplish this we pass a function as the <code>filter</code> option. This function gets called for each feature in your GeoJSON layer, and gets passed the <code>feature</code> and the <code>layer</code>. You can then utilise the values in the feature's properties to control the visibility by returning <code>true</code> or <code>false</code>.</p>
|
250
|
+
|
251
|
+
<p>In the example below "Busch Field" will not be shown on the map.</p>
|
252
|
+
|
253
|
+
<pre><code>var someFeatures = [{
|
254
|
+
"type": "Feature",
|
255
|
+
"properties": {
|
256
|
+
"name": "Coors Field",
|
257
|
+
"show_on_map": true
|
258
|
+
},
|
259
|
+
"geometry": {
|
260
|
+
"type": "Point",
|
261
|
+
"coordinates": [-104.99404, 39.75621]
|
262
|
+
}
|
263
|
+
}, {
|
264
|
+
"type": "Feature",
|
265
|
+
"properties": {
|
266
|
+
"name": "Busch Field",
|
267
|
+
"show_on_map": false
|
268
|
+
},
|
269
|
+
"geometry": {
|
270
|
+
"type": "Point",
|
271
|
+
"coordinates": [-104.98404, 39.74621]
|
272
|
+
}
|
273
|
+
}];
|
274
|
+
|
275
|
+
L.geoJson(someFeatures, {
|
276
|
+
filter: function(feature, layer) {
|
277
|
+
return feature.properties.show_on_map;
|
278
|
+
}
|
279
|
+
}).addTo(map);</code></pre>
|
280
|
+
|
281
|
+
<p>View the <a href="geojson-example.html">example page</a> to see in detail what is possible with the GeoJSON layer.</p>
|
@@ -0,0 +1,205 @@
|
|
1
|
+
---
|
2
|
+
layout: tutorial_v2
|
3
|
+
title: Using GeoJSON with Leaflet
|
4
|
+
---
|
5
|
+
|
6
|
+
<h3>Using GeoJSON with Leaflet</h3>
|
7
|
+
|
8
|
+
<p>GeoJSON is becoming a very popular data format among many GIS technologies and services — it's simple, lightweight, straightforward, and Leaflet is quite good at handling it. In this example, you'll learn how to create and interact with map vectors created from <a href="http://geojson.org/">GeoJSON</a> objects.</p>
|
9
|
+
|
10
|
+
{% include frame.html url="example.html" %}
|
11
|
+
|
12
|
+
<h3>About GeoJSON</h3>
|
13
|
+
|
14
|
+
<p>According to <a href="http://geojson.org">http://geojson.org</a>:</p>
|
15
|
+
|
16
|
+
<blockquote>GeoJSON is a format for encoding a variety of geographic data structures. A GeoJSON object may represent a geometry, a feature, or a collection of features. GeoJSON supports the following geometry types: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection. Features in GeoJSON contain a geometry object and additional properties, and a feature collection represents a list of features.</blockquote>
|
17
|
+
|
18
|
+
<p>Leaflet supports all of the GeoJSON types above, but <a href="http://geojson.org/geojson-spec.html#feature-objects">Features</a> and <a href="http://geojson.org/geojson-spec.html#feature-collection-objects">FeatureCollections</a> work best as they allow you to describe features with a set of properties. We can even use these properties to style our Leaflet vectors. Here's an example of a simple GeoJSON feature:</p>
|
19
|
+
|
20
|
+
<pre><code>var geojsonFeature = {
|
21
|
+
"type": "Feature",
|
22
|
+
"properties": {
|
23
|
+
"name": "Coors Field",
|
24
|
+
"amenity": "Baseball Stadium",
|
25
|
+
"popupContent": "This is where the Rockies play!"
|
26
|
+
},
|
27
|
+
"geometry": {
|
28
|
+
"type": "Point",
|
29
|
+
"coordinates": [-104.99404, 39.75621]
|
30
|
+
}
|
31
|
+
};
|
32
|
+
</code></pre>
|
33
|
+
|
34
|
+
<h3>The GeoJSON layer</h3>
|
35
|
+
|
36
|
+
<p>GeoJSON objects are added to the map through a <a href="http://leafletjs.com/reference.html#geojson">GeoJSON layer</a>. To create it and add it to a map, we can use the following code:</p>
|
37
|
+
|
38
|
+
<pre><code>L.geoJSON(geojsonFeature).addTo(map);</code></pre>
|
39
|
+
|
40
|
+
<p>GeoJSON objects may also be passed as an array of valid GeoJSON objects.</p>
|
41
|
+
|
42
|
+
<pre><code>var myLines = [{
|
43
|
+
"type": "LineString",
|
44
|
+
"coordinates": [[-100, 40], [-105, 45], [-110, 55]]
|
45
|
+
}, {
|
46
|
+
"type": "LineString",
|
47
|
+
"coordinates": [[-105, 40], [-110, 45], [-115, 55]]
|
48
|
+
}];
|
49
|
+
</code></pre>
|
50
|
+
|
51
|
+
<p>Alternatively, we could create an empty GeoJSON layer and assign it to a variable so that we can add more features to it later.</p>
|
52
|
+
|
53
|
+
<pre><code>var myLayer = L.geoJSON().addTo(map);
|
54
|
+
myLayer.addData(geojsonFeature);
|
55
|
+
</code></pre>
|
56
|
+
|
57
|
+
<h3>Options</h3>
|
58
|
+
|
59
|
+
<h4>style</h4>
|
60
|
+
|
61
|
+
<p>The <code>style</code> option can be used to style features two different ways. First, we can pass a simple object that styles all paths (polylines and polygons) the same way:</p>
|
62
|
+
|
63
|
+
<pre><code>var myLines = [{
|
64
|
+
"type": "LineString",
|
65
|
+
"coordinates": [[-100, 40], [-105, 45], [-110, 55]]
|
66
|
+
}, {
|
67
|
+
"type": "LineString",
|
68
|
+
"coordinates": [[-105, 40], [-110, 45], [-115, 55]]
|
69
|
+
}];
|
70
|
+
|
71
|
+
var myStyle = {
|
72
|
+
"color": "#ff7800",
|
73
|
+
"weight": 5,
|
74
|
+
"opacity": 0.65
|
75
|
+
};
|
76
|
+
|
77
|
+
L.geoJSON(myLines, {
|
78
|
+
style: myStyle
|
79
|
+
}).addTo(map);</code></pre>
|
80
|
+
|
81
|
+
<p>Alternatively, we can pass a function that styles individual features based on their properties. In the example below we check the "party" property and style our polygons accordingly:</p>
|
82
|
+
|
83
|
+
<pre><code>var states = [{
|
84
|
+
"type": "Feature",
|
85
|
+
"properties": {"party": "Republican"},
|
86
|
+
"geometry": {
|
87
|
+
"type": "Polygon",
|
88
|
+
"coordinates": [[
|
89
|
+
[-104.05, 48.99],
|
90
|
+
[-97.22, 48.98],
|
91
|
+
[-96.58, 45.94],
|
92
|
+
[-104.03, 45.94],
|
93
|
+
[-104.05, 48.99]
|
94
|
+
]]
|
95
|
+
}
|
96
|
+
}, {
|
97
|
+
"type": "Feature",
|
98
|
+
"properties": {"party": "Democrat"},
|
99
|
+
"geometry": {
|
100
|
+
"type": "Polygon",
|
101
|
+
"coordinates": [[
|
102
|
+
[-109.05, 41.00],
|
103
|
+
[-102.06, 40.99],
|
104
|
+
[-102.03, 36.99],
|
105
|
+
[-109.04, 36.99],
|
106
|
+
[-109.05, 41.00]
|
107
|
+
]]
|
108
|
+
}
|
109
|
+
}];
|
110
|
+
|
111
|
+
L.geoJSON(states, {
|
112
|
+
style: function(feature) {
|
113
|
+
switch (feature.properties.party) {
|
114
|
+
case 'Republican': return {color: "#ff0000"};
|
115
|
+
case 'Democrat': return {color: "#0000ff"};
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}).addTo(map);</code></pre>
|
119
|
+
|
120
|
+
<h4>pointToLayer</h4>
|
121
|
+
|
122
|
+
<p>Points are handled differently than polylines and polygons. By default simple markers are drawn for GeoJSON Points. We can alter this by passing a <code>pointToLayer</code> function in a <a href="http://leafletjs.com/reference.html#geojson-options">GeoJSON options</a> object when creating the GeoJSON layer. This function is passed a <a href="http://leafletjs.com/reference.html#latlng">LatLng</a> and should return an instance of ILayer, in this case likely a <a href="http://leafletjs.com/reference.html#marker">Marker</a> or <a href="http://leafletjs.com/reference.html#circlemarker">CircleMarker</a>.</p>
|
123
|
+
|
124
|
+
<p>Here we're using the <code>pointToLayer</code> option to create a CircleMarker:</p>
|
125
|
+
|
126
|
+
<pre><code>var geojsonMarkerOptions = {
|
127
|
+
radius: 8,
|
128
|
+
fillColor: "#ff7800",
|
129
|
+
color: "#000",
|
130
|
+
weight: 1,
|
131
|
+
opacity: 1,
|
132
|
+
fillOpacity: 0.8
|
133
|
+
};
|
134
|
+
|
135
|
+
L.geoJSON(someGeojsonFeature, {
|
136
|
+
pointToLayer: function (feature, latlng) {
|
137
|
+
return L.circleMarker(latlng, geojsonMarkerOptions);
|
138
|
+
}
|
139
|
+
}).addTo(map);</code></pre>
|
140
|
+
|
141
|
+
<p>We could also set the <code>style</code> property in this example — Leaflet is smart enough to apply styles to GeoJSON points if you create a vector layer like circle inside the <code>pointToLayer</code> function.</p>
|
142
|
+
|
143
|
+
<h4>onEachFeature</h4>
|
144
|
+
|
145
|
+
<p>The <code>onEachFeature</code> option is a function that gets called on each feature before adding it to a GeoJSON layer. A common reason to use this option is to attach a popup to features when they are clicked.</p>
|
146
|
+
|
147
|
+
<pre><code>function onEachFeature(feature, layer) {
|
148
|
+
// does this feature have a property named popupContent?
|
149
|
+
if (feature.properties && feature.properties.popupContent) {
|
150
|
+
layer.bindPopup(feature.properties.popupContent);
|
151
|
+
}
|
152
|
+
}
|
153
|
+
|
154
|
+
var geojsonFeature = {
|
155
|
+
"type": "Feature",
|
156
|
+
"properties": {
|
157
|
+
"name": "Coors Field",
|
158
|
+
"amenity": "Baseball Stadium",
|
159
|
+
"popupContent": "This is where the Rockies play!"
|
160
|
+
},
|
161
|
+
"geometry": {
|
162
|
+
"type": "Point",
|
163
|
+
"coordinates": [-104.99404, 39.75621]
|
164
|
+
}
|
165
|
+
};
|
166
|
+
|
167
|
+
L.geoJSON(geojsonFeature, {
|
168
|
+
onEachFeature: onEachFeature
|
169
|
+
}).addTo(map);</code></pre>
|
170
|
+
|
171
|
+
<h4>filter</h4>
|
172
|
+
|
173
|
+
<p>The <code>filter</code> option can be used to control the visibility of GeoJSON features. To accomplish this we pass a function as the <code>filter</code> option. This function gets called for each feature in your GeoJSON layer, and gets passed the <code>feature</code> and the <code>layer</code>. You can then utilise the values in the feature's properties to control the visibility by returning <code>true</code> or <code>false</code>.</p>
|
174
|
+
|
175
|
+
<p>In the example below "Busch Field" will not be shown on the map.</p>
|
176
|
+
|
177
|
+
<pre><code>var someFeatures = [{
|
178
|
+
"type": "Feature",
|
179
|
+
"properties": {
|
180
|
+
"name": "Coors Field",
|
181
|
+
"show_on_map": true
|
182
|
+
},
|
183
|
+
"geometry": {
|
184
|
+
"type": "Point",
|
185
|
+
"coordinates": [-104.99404, 39.75621]
|
186
|
+
}
|
187
|
+
}, {
|
188
|
+
"type": "Feature",
|
189
|
+
"properties": {
|
190
|
+
"name": "Busch Field",
|
191
|
+
"show_on_map": false
|
192
|
+
},
|
193
|
+
"geometry": {
|
194
|
+
"type": "Point",
|
195
|
+
"coordinates": [-104.98404, 39.74621]
|
196
|
+
}
|
197
|
+
}];
|
198
|
+
|
199
|
+
L.geoJSON(someFeatures, {
|
200
|
+
filter: function(feature, layer) {
|
201
|
+
return feature.properties.show_on_map;
|
202
|
+
}
|
203
|
+
}).addTo(map);</code></pre>
|
204
|
+
|
205
|
+
<p>View the <a href="example.html">example page</a> to see in detail what is possible with the GeoJSON layer.</p>
|