-
Notifications
You must be signed in to change notification settings - Fork 790
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add feature mutli-styling using the select symbol; feature_multi_styl…
…ing.earth demo file
- Loading branch information
Showing
3 changed files
with
119 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<!-- | ||
By using include "select" symbols in the Roads layer, you can select multiple | ||
styles for each feature. Styles render in the order of appearance. The "select" | ||
symbol can take any javascript expression. | ||
|
||
This demo will render all road backgrounds first, and then the roads | ||
themselves afterwards for a nice outlining effect. | ||
--> | ||
|
||
<map name="Demo: feature mulit-styling"> | ||
|
||
<XYZFeatures name="osm-roads"> | ||
<url>https://readymap.org/readymap/mbtiles/daylight-v1.2/{z}/{x}/{-y}.pbf</url> | ||
<min_level>14</min_level> | ||
<max_level>14</max_level> | ||
<profile>spherical-mercator</profile> | ||
<format>pbf</format> | ||
<fid_attribute>@id</fid_attribute> | ||
<filters> | ||
<attributes>highway</attributes> | ||
</filters> | ||
</XYZFeatures> | ||
|
||
<TMSImage name="Imagery"> | ||
<url>https://readymap.org/readymap/tiles/1.0.0/7</url> | ||
</TMSImage> | ||
|
||
<FeatureImage name="Roads" min_level="14" max_data_level="19"> | ||
<tile_size>512</tile_size> | ||
<features>osm-roads</features> | ||
<buffer_width>25m</buffer_width> | ||
<styles> | ||
<style type="text/css"> | ||
minor_road_outline { | ||
select: !is_major(); | ||
stroke: #ffffff; | ||
stroke-width: 15m; | ||
} | ||
major_road_outline { | ||
select: is_major(); | ||
stroke: #ffffff; | ||
stroke-width: 20m; | ||
} | ||
minor_road { | ||
select: !is_major(); | ||
stroke: #3f3f3f; | ||
stroke-width: 10m; | ||
} | ||
major_road { | ||
select: is_major(); | ||
stroke: #1f1f1f; | ||
stroke-width: 15m; | ||
} | ||
</style> | ||
<script><![CDATA[ | ||
function is_major() { | ||
var v = feature.properties.highway; | ||
return v === 'trunk' || v === 'primary' || v === 'motorway' || v === 'secondary' || v === 'tertiary'; | ||
} | ||
]]> | ||
</script> | ||
</styles> | ||
</FeatureImage> | ||
|
||
<Viewpoints home="0" time="1"> | ||
<viewpoint name="Annandale"> | ||
<heading>-3.2425e-07</heading> | ||
<pitch>-89</pitch> | ||
<range>2928.14m</range> | ||
<long>-77.19548706709453</long> | ||
<lat>38.83147622799055</lat> | ||
</viewpoint> | ||
</Viewpoints> | ||
</map> |