4
This one demonstrates how to read feature data from a shapefile and "drape" it
5
on the map using a stenciling technique. This technique is more compute-intensive
6
than the overlay technique, but it is much more flexible and it works in a
7
whole-earth environment.
9
This demo loads a shapefile of the world, and colors each country based
10
on its population count using feature style classes.
12
Note the use of the XML CDATA tag in the expressions. This is only required if
13
you use XML special characters in the expression (in this case, the less-than
14
and greater-than symbols). CDATA "escapes out" of XML parsing within the CDATA
18
<map name="Feature Stencil Demo" type="geocentric" version="2">
20
<options lighting="false"/>
22
<image name="world" driver="gdal">
23
<url>../data/world.tif</url>
26
<model name="countries" driver="feature_stencil">
28
<!-- Configure the OGR feature driver to read the shapefile.
29
Applying a slight negative buffer will "erode" the
30
shapes, highlighting the borders between countries. -->
32
<features name="states" driver="ogr">
33
<url>../data/world.shp</url>
34
<ogr_driver>ESRI Shapefile</ogr_driver>
35
<buffer distance="-0.05"/>
38
<!-- Since some countries span large areas on the globe, we need to
39
use a larger-than-normal extrusion distance on the stencil
40
volumes. (300000 is the default for a geocentric map.) -->
42
<extrusion_distance>400000</extrusion_distance>
44
<!-- Define a feature style class for each category: -->
48
<style type="text/css">
73
<expr><![CDATA[ POP_CNTRY <= 14045470 ]]></expr>
79
<expr><![CDATA[ POP_CNTRY > 14045470 and POP_CNTRY <= 43410900 ]]></expr>
85
<expr><![CDATA[ POP_CNTRY > 43410900 and POP_CNTRY <= 97228750 ]]></expr>
91
<expr><![CDATA[ POP_CNTRY > 97228750 and POP_CNTRY <= 258833000 ]]></expr>
97
<expr><![CDATA[ POP_CNTRY > 258833000 ]]></expr>