image - Geoserver SLD styling issue with external graphics and attribute rules -
i creating sld geoserver wms layer. sld validates without error icons not show in map. using attribute based rules compare strings have correct image show correct feature. here code , help!
<?xml version="1.0" encoding="iso-8859-1"?> <styledlayerdescriptor version="1.0.0" xsi:schemalocation="http://www.opengis.net/sld styledlayerdescriptor.xsd" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <namedlayer> <name>upper shore image points</name> <userstyle> <title>vendor points</title> <featuretypestyle> <rule> <name>famers market</name> <title>all farmers markets</title> <ogc:filter> <ogc:propertyislike wildcard="*" singlechar="." escape="!"> <ogc:propertyname>type</ogc:propertyname> <ogc:literal>farmers maket vendor</ogc:literal> </ogc:propertyislike> </ogc:filter> <pointsymbolizer> <graphic> <externalgraphic> <onlineresource xlink:type="simple" xlink:href="farmers markets.jpg" /> <format>image/jpeg</format> </externalgraphic> <size>32</size> </graphic> </pointsymbolizer> </rule> <rule> <name>fruit , vegetable</name> <title>all fruit , vegetable</title> <ogc:filter> <ogc:propertyislike wildcard="*" singlechar="." escape="!"> <ogc:propertyname>type</ogc:propertyname> <ogc:literal>fruit , vegetable farm</ogc:literal> </ogc:propertyislike> </ogc:filter> <pointsymbolizer> <graphic> <externalgraphic> <onlineresource xlink:type="simple" xlink:href="fruit , vegetable farms.jpg" /> <format>image/jpeg</format> </externalgraphic> <size>32</size> </graphic> </pointsymbolizer> </rule> <rule> <name>horse stable</name> <title>all horse stables</title> <ogc:filter> <ogc:propertyislike wildcard="*" singlechar="." escape="!"> <ogc:propertyname>type</ogc:propertyname> <ogc:literal>horse stable</ogc:literal> </ogc:propertyislike> </ogc:filter> <pointsymbolizer> <graphic> <externalgraphic> <onlineresource xlink:type="simple" xlink:href="horse stable.jpg" /> <format>image/jpeg</format> </externalgraphic> <size>32</size> </graphic> </pointsymbolizer> </rule> <rule> <name>wool products</name> <title>all wool products</title> <ogc:filter> <ogc:propertyislike wildcard="*" singlechar="." escape="!"> <ogc:propertyname>type</ogc:propertyname> <ogc:literal>wool products</ogc:literal> </ogc:propertyislike> </ogc:filter> <pointsymbolizer> <graphic> <externalgraphic> <onlineresource xlink:type="simple" xlink:href="wool products.jpg" /> <format>image/jpeg</format> </externalgraphic> <size>32</size> </graphic> </pointsymbolizer> </rule> <rule> <name>restaurant</name> <title>all restaurants</title> <ogc:filter> <ogc:propertyislike wildcard="*" singlechar="." escape="!"> <ogc:propertyname>type</ogc:propertyname> <ogc:literal>restaurant</ogc:literal> </ogc:propertyislike> </ogc:filter> <pointsymbolizer> <graphic> <externalgraphic> <onlineresource xlink:type="simple" xlink:href="restaurant.jpg" /> <format>image/jpeg</format> </externalgraphic> <size>32</size> </graphic> </pointsymbolizer> </rule> <rule> <name>coffee roasting</name> <title>all coffee roasting</title> <ogc:filter> <ogc:propertyislike wildcard="*" singlechar="." escape="!"> <ogc:propertyname>type</ogc:propertyname> <ogc:literal>coffee roasting</ogc:literal> </ogc:propertyislike> </ogc:filter> <pointsymbolizer> <graphic> <externalgraphic> <onlineresource xlink:type="simple" xlink:href="coffee roasting.jpg" /> <format>image/jpeg</format> </externalgraphic> <size>32</size> </graphic> </pointsymbolizer> </rule> <rule> <name>charter service</name> <title>all charter services</title> <ogc:filter> <ogc:propertyislike wildcard="*" singlechar="." escape="!"> <ogc:propertyname>type</ogc:propertyname> <ogc:literal>charter service</ogc:literal> </ogc:propertyislike> </ogc:filter> <pointsymbolizer> <graphic> <externalgraphic> <onlineresource xlink:type="simple" xlink:href="charter service.jpg" /> <format>image/jpeg</format> </externalgraphic> <size>32</size> </graphic> </pointsymbolizer> </rule> <rule> <name>apiary</name> <title>all apiaries</title> <ogc:filter> <ogc:propertyislike wildcard="*" singlechar="." escape="!"> <ogc:propertyname>type</ogc:propertyname> <ogc:literal>apiary</ogc:literal> </ogc:propertyislike> </ogc:filter> <pointsymbolizer> <graphic> <externalgraphic> <onlineresource xlink:type="simple" xlink:href="apiary.jpg" /> <format>image/jpeg</format> </externalgraphic> <size>32</size> </graphic> </pointsymbolizer> </rule> <rule> <name>vineyard</name> <title>all vineyards</title> <ogc:filter> <ogc:propertyislike wildcard="*" singlechar="." escape="!"> <ogc:propertyname>type</ogc:propertyname> <ogc:literal>vineyard</ogc:literal> </ogc:propertyislike> </ogc:filter> <pointsymbolizer> <graphic> <externalgraphic> <onlineresource xlink:type="simple" xlink:href="vineyard.jpg" /> <format>image/jpeg</format> </externalgraphic> <size>32</size> </graphic> </pointsymbolizer> </rule> <rule> <name>retail seafood</name> <title>all retail seafood</title> <ogc:filter> <ogc:propertyislike wildcard="*" singlechar="." escape="!"> <ogc:propertyname>type</ogc:propertyname> <ogc:literal>retail seafood</ogc:literal> </ogc:propertyislike> </ogc:filter> <pointsymbolizer> <graphic> <externalgraphic> <onlineresource xlink:type="simple" xlink:href="retail seafood.jpg" /> <format>image/jpeg</format> </externalgraphic> <size>32</size> </graphic> </pointsymbolizer> </rule> <rule> <name>bakery</name> <title>all bakeries</title> <ogc:filter> <ogc:propertyislike wildcard="*" singlechar="." escape="!"> <ogc:propertyname>type</ogc:propertyname> <ogc:literal>bakery</ogc:literal> </ogc:propertyislike> </ogc:filter> <pointsymbolizer> <graphic> <externalgraphic> <onlineresource xlink:type="simple" xlink:href="bakery.jpg" /> <format>image/jpeg</format> </externalgraphic> <size>32</size> </graphic> </pointsymbolizer> </rule> <rule> <name>dairy/eggs</name> <title>all dairy/ eggs</title> <ogc:filter> <ogc:propertyislike wildcard="*" singlechar="." escape="!"> <ogc:propertyname>type</ogc:propertyname> <ogc:literal>dairy/eggs</ogc:literal> </ogc:propertyislike> </ogc:filter> <pointsymbolizer> <graphic> <externalgraphic> <onlineresource xlink:type="simple" xlink:href="dairy_eggs.jpg" /> <format>image/jpeg</format> </externalgraphic> <size>32</size> </graphic> </pointsymbolizer> </rule> <rule> <name>christmas tree farm</name> <title>all christmas tree farms</title> <ogc:filter> <ogc:propertyislike wildcard="*" singlechar="." escape="!"> <ogc:propertyname>type</ogc:propertyname> <ogc:literal>christmas tree farm</ogc:literal> </ogc:propertyislike> </ogc:filter> <pointsymbolizer> <graphic> <externalgraphic> <onlineresource xlink:type="simple" xlink:href="christmas tree farm.jpg" /> <format>image/jpeg</format> </externalgraphic> <size>32</size> </graphic> </pointsymbolizer> </rule> <rule> <name>grains</name> <title>all grain farms</title> <ogc:filter> <ogc:propertyislike wildcard="*" singlechar="." escape="!"> <ogc:propertyname>type</ogc:propertyname> <ogc:literal>grains</ogc:literal> </ogc:propertyislike> </ogc:filter> <pointsymbolizer> <graphic> <externalgraphic> <onlineresource xlink:type="simple" xlink:href="grains.jpg" /> <format>image/jpeg</format> </externalgraphic> <size>32</size> </graphic> </pointsymbolizer> </rule> <rule> <name>meat products</name> <title>all meat products</title> <ogc:filter> <ogc:propertyislike wildcard="*" singlechar="." escape="!"> <ogc:propertyname>type</ogc:propertyname> <ogc:literal>meat products</ogc:literal> </ogc:propertyislike> </ogc:filter> <pointsymbolizer> <graphic> <externalgraphic> <onlineresource xlink:type="simple" xlink:href="meat.jpg" /> <format>image/jpeg</format> </externalgraphic> <size>32</size> </graphic> </pointsymbolizer> </rule> <rule> <name>nursery</name> <title>all nurseries</title> <ogc:filter> <ogc:propertyislike wildcard="*" singlechar="." escape="!"> <ogc:propertyname>type</ogc:propertyname> <ogc:literal>nursery</ogc:literal> </ogc:propertyislike> </ogc:filter> <pointsymbolizer> <graphic> <externalgraphic> <onlineresource xlink:type="simple" xlink:href="nursery.jpg" /> <format>image/jpeg</format> </externalgraphic> <size>32</size> </graphic> </pointsymbolizer> </rule> <rule> <name>petting zoo</name> <title>all petting zoos</title> <ogc:filter> <ogc:propertyislike wildcard="*" singlechar="." escape="!"> <ogc:propertyname>type</ogc:propertyname> <ogc:literal>petting zoo</ogc:literal> </ogc:propertyislike> </ogc:filter> <pointsymbolizer> <graphic> <externalgraphic> <onlineresource xlink:type="simple" xlink:href="petting zoo.jpg" /> <format>image/jpeg</format> </externalgraphic> <size>32</size> </graphic> </pointsymbolizer> </rule> </featuretypestyle> </userstyle>
i realize post old maybe benefit answer.
i didn't succeed in using relative image paths turned using url paths.
put image(s) in $geoserver_data_dir/styles , reference http://localhost:8081/geoserver/styles/some_image.png
for example
<externalgraphic> <onlineresource xlink:type="simple" xlink:href="http://localhost:8081/geoserver/styles/some_image.png"/> <format>image/png</format> </externalgraphic>
Comments
Post a Comment