[OpenLayers-Users] how to style vector layer points from values of GeoRSS tag?

Marc Jansen jansen at terrestris.de
Fri Aug 5 04:26:04 EDT 2011


Hi Fabio,

I suggest looking at this part of the documentation:
http://docs.openlayers.org/library/feature_styling.html#rule-based-styling

The example with "ruleLow" and "ruleHigh" in the "Custom Rules" section
should be equivalent to what you are trying to accomplish.

Best regards,
Marc


On 05.08.2011 04:10, fabiowebby wrote:
> Hi All,
> I'm using OpenLayers to show some data related to my dissertation project. I
> have some earthquakes data(lat,long,magnitude etc...) in Mysql database and
> I generate a GeoRSS file using a php script which is read by OpenLayers. The
> GeoRSS file structure is as following:
>
> <item>
> <title>Earthquake Magnitude:3</title>
> <description>Earthquake M3 on 1971-01-03 at 21:42:52</description>
> <pubDate>1971-01-03</pubDate>
> <magnitude>3</magnitude>
> <geo:lat>51.25</geo:lat>
> <geo:long>-179.3</geo:long>
> </item>
>
> The GeoRSS file is read perfectly by OpenLayers and I am able to show point
> on the map using the following code on a google layer:
>
> var earthquakes = new OpenLayers.Layer.Vector("Earthquakes", {
>     strategies: [new OpenLayers.Strategy.Fixed()],
>     protocol: new OpenLayers.Protocol.HTTP({
>         url: "files/test.xml",
>         format: new OpenLayers.Format.GeoRSS()
>     })
> });
>
> Now it comes the step where I am stuck with. At this point I need to give
> some style to these points and more specifically the style should be based
> on the value from the magnitude tag in the GeoRSS file. That is, minor
> earthquakes should appear in green and small in radius, medium in yellow and
> larger radius and violent earthquakes should be red and radius bigger than
> the others. I have tried to follow the flickr example but unfortunately my
> javascript knowledge is very little and I was not able to understand it but
> I guess it is something very similar syntactically. Could someone please
> help me with this or at least point me to the right direction? I'd
> appreciate it very much.
> Thank you very much in advance 
> Regards 
> Fabio
>  
>
> --
> View this message in context: http://osgeo-org.1803224.n2.nabble.com/how-to-style-vector-layer-points-from-values-of-GeoRSS-tag-tp6655038p6655038.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>



More information about the Users mailing list