[GeoNode-users] GeoNode Layer Style Weather Symbols and Web Links

Julierme Pinheiro juliermeopensourcedeveloper at gmail.com
Mon Jan 21 12:44:58 PST 2019


Dear Toni,

Let me make a correction to my previous email:

The closest I could reach was by getting gray square symbols instead of
images by using this path
<sld:OnlineResource xlink:type="simple" xlink:href="
172.18.0.6/usr/local/tomcat/weabapps/geoserver/data/styles/day.svg"/>

The other ones, I could not get response at all:

<sld:OnlineResource xlink:type="simple"
xlink:href="c3499bb0ae79:/usr/local/tomcat/weabapps/geoserver/data/styles/day.svg"/>
<sld:OnlineResource xlink:type="simple"
xlink:href="geoserver4my_geonode:/usr/local/tomcat/weabapps/geoserver/data/styles/day.svg"/>

Thank you very much for your time

Kind regards

Julierme


On Mon, Jan 21, 2019 at 6:30 PM Julierme Pinheiro <
juliermeopensourcedeveloper at gmail.com> wrote:

> Hi Toni,
>
> Regarding my previous email, GeoServer at 2.14.2 was causing the problem. I
> removed GeoServer at 2.14.2 and installed GeoServer at 2.14.1 and issue is
> solved. Find geo.sld bellow working smoothly on GeoServer at 2.14.1 and a
> screenshot of tb_brasilia_weather layer. Now, I am doing the same thing in
> my GeoNode at 2.8 in a CenTos7 Server installed via Docker and
> GeoServer at 2-13-SNAPSHOT in geoserver4my_geonode container.
>
> Using the same geo.sld file, I am having some problem trying to reach the
> image files in geoserver4my_geonode container.  I tried  the settings
> bellow without no success.
> <sld:OnlineResource xlink:type="simple"
> xlink:href="c3499bb0ae79:/usr/local/tomcat/weabapps/geoserver/data/day.svg"/>
> <sld:OnlineResource xlink:type="simple"
> xlink:href="geoserver4my_geonode:/usr/local/tomcat/weabapps/geoserver/data/day.svg"/>
> <sld:OnlineResource xlink:type="simple" xlink:href="172.18.0.6:
> /usr/local/tomcat/weabapps/geoserver/data/day.svg"/>
>
> Any suggestion or comment on this issue will be very appreciated.
>
> I appreciated your time and help
>
> Kind regards
>
> Julierme
>
>
> *geo.sld *
>
> <?xml version="1.0" encoding="UTF-8"?><sld:StyledLayerDescriptor xmlns="
> http://www.opengis.net/sld" xmlns:sld="http://www.opengis.net/sld"
> xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="
> http://www.opengis.net/ogc" version="1.0.0" xsi:schemaLocation="
> http://www.opengis.net/sld StyledLayerDescriptor.xsd" xmlns:xlink="
> http://www.w3.org/1999/xlink" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance">
>   <sld:NamedLayer>
>     <sld:Name>geo_sipam</sld:Name>
>     <sld:UserStyle>
>       <sld:Name>geo_sipam</sld:Name>
>       <sld:FeatureTypeStyle>
>         <sld:Rule>
>           <ogc:Filter>
>             <ogc:PropertyIsEqualTo>
>               <ogc:PropertyName>weather</ogc:PropertyName>
>               <ogc:Literal>0</ogc:Literal>
>             </ogc:PropertyIsEqualTo>
>           </ogc:Filter>
>           <sld:PointSymbolizer>
>             <sld:Graphic>
>            <sld:ExternalGraphic>
>              <sld:OnlineResource xlink:type="simple" xlink:href="day.svg"/>
>              <sld:Format>image/svg+xml</sld:Format>
>            </sld:ExternalGraphic>
>            <sld:Size>100</sld:Size>
>          </sld:Graphic>
>           </sld:PointSymbolizer>
>         </sld:Rule>
>         <sld:Rule>
>           <ogc:Filter>
>             <ogc:PropertyIsEqualTo>
>               <ogc:PropertyName>weather</ogc:PropertyName>
>               <ogc:Literal>1</ogc:Literal>
>             </ogc:PropertyIsEqualTo>
>           </ogc:Filter>
>           <sld:PointSymbolizer>
>             <sld:Graphic>
>            <sld:ExternalGraphic>
>              <sld:OnlineResource xlink:type="simple" xlink:href="day.svg"/>
>              <sld:Format>image/svg+xml</sld:Format>
>            </sld:ExternalGraphic>
>            <sld:Size>100</sld:Size>
>          </sld:Graphic>
>           </sld:PointSymbolizer>
>         </sld:Rule>
>         <sld:Rule>
>         <ogc:Filter>
>             <ogc:PropertyIsEqualTo>
>               <ogc:PropertyName>weather</ogc:PropertyName>
>               <ogc:Literal>2</ogc:Literal>
>             </ogc:PropertyIsEqualTo>
>         </ogc:Filter>
>         <sld:PointSymbolizer>
>          <sld:Graphic>
>            <sld:ExternalGraphic>
>              <sld:OnlineResource xlink:type="simple"
> xlink:href="thunder.svg"/>
>              <sld:Format>image/svg+xml</sld:Format>
>            </sld:ExternalGraphic>
>            <sld:Size>100</sld:Size>
>          </sld:Graphic>
>         </sld:PointSymbolizer>
>         </sld:Rule>
>         <sld:Rule>
>         <ogc:Filter>
>             <ogc:PropertyIsEqualTo>
>               <ogc:PropertyName>weather</ogc:PropertyName>
>               <ogc:Literal>3</ogc:Literal>
>             </ogc:PropertyIsEqualTo>
>         </ogc:Filter>
>         <sld:PointSymbolizer>
>          <sld:Graphic>
>            <sld:ExternalGraphic>
>              <sld:OnlineResource xlink:type="simple"
> xlink:href="snowy-1.svg"/>
>              <sld:Format>image/svg+xml</sld:Format>
>            </sld:ExternalGraphic>
>            <sld:Size>100</sld:Size>
>          </sld:Graphic>
>         </sld:PointSymbolizer>
>         </sld:Rule>
>         <sld:Rule>
>         <ogc:Filter>
>             <ogc:PropertyIsEqualTo>
>               <ogc:PropertyName>weather</ogc:PropertyName>
>               <ogc:Literal>4</ogc:Literal>
>             </ogc:PropertyIsEqualTo>
>         </ogc:Filter>
>         <sld:PointSymbolizer>
>          <sld:Graphic>
>            <sld:ExternalGraphic>
>              <sld:OnlineResource xlink:type="simple"
> xlink:href="rainy-1.svg"/>
>              <sld:Format>image/svg+xml</sld:Format>
>            </sld:ExternalGraphic>
>            <sld:Size>100</sld:Size>
>          </sld:Graphic>
>         </sld:PointSymbolizer>
>         </sld:Rule>
>         <sld:VendorOption name="ruleEvaluation">first</sld:VendorOption>
>       </sld:FeatureTypeStyle>
>     </sld:UserStyle>
>   </sld:NamedLayer>
> </sld:StyledLayerDescriptor>
>
>
> On Mon, Jan 21, 2019 at 3:18 PM Julierme Pinheiro <
> juliermeopensourcedeveloper at gmail.com> wrote:
>
>> Hi Toni,
>>
>> am I correct that you´re using the geoserver css extension?
>>
>> Yes. You are right. I am using css extension.
>>
>> Can you supply the generated sld?
>>
>> Yes. I am send it in attached.
>>
>> $ ll ./geoserver/data/styles/thunder.svg
>>
>> -rwxr-xr-x 1 tomcat8 tomcat8 1918 jan 21 10:52 ./thunder.svg*
>>
>> I changed geonode_css.css file as shown bellow and I am sending
>> geonode_css.sld in attached. It still not working.
>>
>> * [weather = 4]{
>>   mark: symbol('circle');
>>   mark-size: 5;
>> }
>>
>> :mark {
>>   fill: cyan;
>>   stroke: darkblue;
>> }
>>
>> [weather = 0] {
>>   mark: url(day.svg);
>>   mark-mime: "image/svg";
>>   mark-size: 100;
>> }
>>
>>
>> I appreciated you help and time.
>>
>> Kind regards
>>
>> Julierme
>>
>> On Mon, Jan 21, 2019 at 2:08 PM Toni Schönbuchner <
>> toni.schoenbuchner at csgis.de> wrote:
>>
>>> Hey Julierme,
>>>
>>> am I correct that you´re using the geoserver css extension?
>>> Can you supply the generated sld?
>>>
>>> Further the output of:
>>>
>>> $ ll ./geoserver/data/styles/sunny.svg
>>>
>>> Further I think the mime type in sld for svg is
>>> <Format>image/svg+xml" </Format>
>>>
>>> your could try
>>> mark-mime: "image/svg+xml"
>>> (unsure about this just a shot in the dark)
>>>
>>> Cheers,
>>> Toni
>>>
>>> -----------------------------------------------
>>> CSGIS
>>>
>>> -----------------------------------------------
>>> Kolonnadenstraße 1
>>> 04109 Leipzig
>>> -----------------------------------------------
>>> Tel  +49/ (0) 341 24 04 738
>>> Fax  +49/ (0) 341 24 04 739
>>> Web http://csgis.de
>>> -----------------------------------------------
>>>
>>> Hinweis gemäß § 33 BDSG
>>> Daten der Verfahrensbeteiligten werden gespeichert. Dieses Dokument ist
>>> ausschließlich für den
>>> Adressaten bestimmt. Der Inhalt der E-Mail ist vertraulich. Falls Sie
>>> diese E-Mail versehentlich
>>> erhalten haben, rufen Sie uns unter obiger Rufnummer umgehend an und
>>> löschen Sie diese Nachricht
>>> von Ihrem Computer. Jegliche Art von Reproduktionen, Verbreitung,
>>> Vervielfältigung, Veränderung,
>>> Verteilung und/oder Veröffentlichung dieser E-Mail ist verboten.
>>>
>>> Am 21.01.2019 um 16:51 schrieb Julierme Pinheiro <
>>> juliermeopensourcedeveloper at gmail.com>:
>>>
>>> Dear Jorge and Toni,
>>>
>>> Thank you very much for your reply.
>>>
>>> I have a table (db_brasilia_weather) in postgis. The table
>>> db_brasilia_weather has two attributes: weather and url_image. weather
>>> attribute has integer values of weather status and url_image attribute: the
>>> path for the weather images cloudy.svg, thunder.svg, sunny.svg, rainy.svg.
>>>
>>> db_brasilia_weather
>>>
>>> id     weather      url_image
>>> 1          0             sunny.svg
>>> 2          5             thunder.svg
>>> 3          1             rainy.svg
>>>
>>> *.svg images are stored in  /webapps/geoserver/data/styles
>>>
>>> Based on the information, Creating Point Styles in [1] and Item 3.4.2
>>> about Graphic in [2], I created the following CSS (geonode.css) file:
>>>
>>> * {
>>>   mark: symbol('circle');
>>>   mark-size: 5;
>>> }
>>>
>>> :mark {
>>>   fill: cyan;
>>>   stroke: darkblue;
>>> }
>>>
>>> [weather = 0] {
>>>   mark: url(./geoserver/data/styles/sunny.svg);
>>>   mark-mime: "image/svg";
>>>   mark-size: 100;
>>> }
>>> I have tried mark: url(sunny.svg),
>>> url("./geoserver/data/styles/sunny.svg"), but none of these configuration
>>> have been successful.
>>>
>>> Any additional comment on this matter will be very appreciated.
>>>
>>> Thank you very much for your time in advance.
>>>
>>> Kind Regards
>>>
>>> Julierme
>>>
>>>
>>> [1]
>>> http://docs.geonode.org/en/master/tutorials/advanced/adv_data_mgmt/pretty_maps/css.html#creating-point-styles
>>> [2]
>>> https://docs.geoserver.org/stable/en/user/styling/workshop/css/point.html
>>>
>>>
>>>
>>>
>>>
>>> On Sun, Jan 20, 2019 at 5:53 AM Toni Schönbuchner <
>>> toni.schoenbuchner at csgis.de> wrote:
>>>
>>>> Hi Julierme,
>>>>
>>>> I don´t think you can access a postgis entity  directly from SLD.
>>>> The Point Symbolizer allows external graphics as mark or ressource.
>>>>
>>>> https://docs.geoserver.org/stable/en/user/styling/sld/reference/pointsymbolizer.html#externalgraphic
>>>> Where an external ressource could also be identified as URL.
>>>>
>>>> Means you could add the SVG to your static root or in some other public
>>>> directory or even dropbox and use it as symbol. As alternative it
>>>> should work
>>>> to specific a relative path outside of the data dir where tomcat is
>>>> allowed to read
>>>> from. With second linking to the file gets harder.
>>>>
>>>> May I ask you why the svg should be stored in the database? – unsure if
>>>> there
>>>> is some better way but for sure you could just create a django view to
>>>> output
>>>> the svg from postgres and use it like this in your sld.
>>>>
>>>> Cheers,
>>>>
>>>> Toni
>>>>
>>>> > Today's Topics:
>>>> >
>>>> >   1. Re: GeoNode Layer Style Weather Symbols and Web  Links
>>>> >      (Julierme Pinheiro)
>>>> >
>>>> >
>>>> > ----------------------------------------------------------------------
>>>> >
>>>> > Message: 1
>>>> > Date: Fri, 18 Jan 2019 18:59:40 -0200
>>>> > From: Julierme Pinheiro <juliermeopensourcedeveloper at gmail.com>
>>>> > To: geonode-users <geonode-users at lists.osgeo.org>
>>>> > Subject: Re: [GeoNode-users] GeoNode Layer Style Weather Symbols and
>>>> >       Web     Links
>>>> > Message-ID:
>>>> >       <CAKTKyJK9dtC9MX_QHHH+bJvswgBzcC=
>>>> BPOwodR840KZLPoZ0aA at mail.gmail.com>
>>>> > Content-Type: text/plain; charset="utf-8"
>>>> >
>>>> > Hi GeoNode users,
>>>> >
>>>> > Regarding my previous email, looking at GeoServer documentation
>>>> > <
>>>> https://docs.geoserver.org/stable/en/user/styling/sld/extensions/pointsymbols.html#external-graphics
>>>> >,
>>>> > I got the piece of SLD bellow, but burg02.svg is being retrieved from
>>>> > $GEOSERVER_DATA_DIR/styles.
>>>> >
>>>> > I would like to have:
>>>> > 1 - burg02.svg being retrieved from a postgres table;
>>>> > 2 - make a webpage link on burg02.svg through the  SLD file
>>>> >
>>>> >
>>>> > <PointSymbolizer>
>>>> >   <Graphic>
>>>> >     <ExternalGraphic>
>>>> >       <OnlineResource xlink:type="simple" xlink:href="burg02.svg" />
>>>> >       <Format>image/svg+xml</Format>
>>>> >     </ExternalGraphic>
>>>> >     <Size>20</Size>
>>>> >   </Graphic>
>>>> > </PointSymbolizer>
>>>> >
>>>> >
>>>> > Any hint on that will be very appreciated.
>>>> >
>>>> > Kind regards
>>>> >
>>>> > Julierme
>>>>
>>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20190121/72eb2772/attachment-0001.html>


More information about the geonode-users mailing list