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

Julierme Pinheiro juliermeopensourcedeveloper at gmail.com
Mon Jan 21 07:51:35 PST 2019


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/98e2165c/attachment.html>


More information about the geonode-users mailing list