Changeset 19879 in osm for applications/editors/josm/haiti_earthquake
- Timestamp:
- 2010-02-05T13:10:14+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/haiti_earthquake/hospitals/HospitalChunkCheck.groovy
r19878 r19879 39 39 return "bbox=${minLon},${minLat},${maxLon},${maxLat}" 40 40 } 41 41 42 42 def int countHospitalsInProximity(node) { 43 43 def bbox = buildQueryBbox(node) 44 44 def queryUrl = "http://xapi.openstreetmap.org/api/0.6/*[amenity=hospital][${bbox}]" 45 45 def xapiResponse = DOMBuilder.parse(new InputStreamReader(new URL(queryUrl).openStream(), "UTF-8")) 46 def int count = xpath.evaluate("count(// node/tag[@k = 'amenity'][@v = 'hospital'])", xapiResponse, XPathConstants.NUMBER)46 def int count = xpath.evaluate("count(//tag[@k = 'amenity'][@v = 'hospital']/..)", xapiResponse, XPathConstants.NUMBER) 47 47 return count 48 48 } … … 52 52 def queryUrl = "http://xapi.openstreetmap.org/api/0.6/*[health_facility:paho_id=*][${bbox}]" 53 53 def xapiResponse = DOMBuilder.parse(new InputStreamReader(new URL(queryUrl).openStream(), "UTF-8")) 54 def int count = xpath.evaluate("count(// node/tag[@k = 'health_facility:paho_id'])", xapiResponse, XPathConstants.NUMBER)54 def int count = xpath.evaluate("count(//tag[@k = 'health_facility:paho_id']/..)", xapiResponse, XPathConstants.NUMBER) 55 55 return count 56 56 } … … 60 60 def queryUrl = "http://xapi.openstreetmap.org/api/0.6/*[health_facility:paho_id=${id}]" 61 61 def xapiResponse = DOMBuilder.parse(new InputStreamReader(new URL(queryUrl).openStream(), "UTF-8")) 62 def int count = xpath.evaluate("count(// node/tag[@k = 'health_facility:paho_id'])", xapiResponse, XPathConstants.NUMBER)62 def int count = xpath.evaluate("count(//tag[@k = 'health_facility:paho_id'][@v ='${id}'])", xapiResponse, XPathConstants.NUMBER) 63 63 return count > 0 64 64 }
Note:
See TracChangeset
for help on using the changeset viewer.