Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm trying to give styles to a new layer about Earthquakes. This is my code and below you have my xml file from where I'm readding:

Code:

var rule1 = new OpenLayers.Rule({
    title: "Magnitude < 2.0",
    filter: new OpenLayers.Filter.Comparison({
        type: OpenLayers.Filter.Comparison.LESS_THAN,
        **property: "subject[0]",**
        value: 2
    }),
    symbolizer: {
    pointRadius: 7,
    fillOpacity: 1,
    externalGraphic: "../img/EarthQuake02.png"
    }
});

XML file:

<rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"     xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>USGS M 2.5+ Earthquakes</title>
<description>Real-time, worldwide earthquake list for the past 7 days</description>
<link>http://earthquake.usgs.gov/earthquakes/</link>
<dc:publisher>U.S. Geological Survey</dc:publisher>
<pubDate>Mon, 11 Feb 2013 19:27:38 GMT</pubDate>
<item>
<pubDate>Mon, 11 Feb 2013 19:13:01 GMT</pubDate>
<title>M 5.3, northern Qinghai, China</title>
<description>February 11, 2013 19:13:01 GMT</description>
<link>http://earthquake.usgs.gov/earthquakes/recenteqsww/Quakes/usc000f5ll.php</link>
<geo:lat>38.5004</geo:lat>
<geo:long>92.3687</geo:long>

<dc:subject>5</dc:subject>
<dc:subject>pasthour</dc:subject>
<dc:subject>14.10 km</dc:subject>

<guid isPermaLink="false">usc000f5ll</guid>
</item>
<item>
<pubDate>Mon, 11 Feb 2013 17:24:04 GMT</pubDate>
<title>M 2.5, Central California</title>
<description>February 11, 2013 17:24:04 GMT</description>
<link>http://earthquake.usgs.gov/earthquakes/recenteqsww/Quakes/nn00402536.php</link>
<geo:lat>36.5024</geo:lat>
<geo:long>-116.5895</geo:long>

<dc:subject>2</dc:subject>
<dc:subject>pastday</dc:subject>
<dc:subject>5.10 km</dc:subject>

<guid isPermaLink="false">nn00402536</guid>
</item>

As you can see, there are 3 properties called dc:subject, but I only need the first one which means the magnitude of the earthquake. ¿Does anybody know how can I select the first one? I have tried this:

 property: subject[0]
 value: 2

but it doesn' work.

Thanks in advance, Regards, Rafael

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.