overpass-frontend
Version:
A JavaScript (NodeJS/Browser) library to easily access data from OpenStreetMap via Overpass API or from an OSM File. The objects can directly be used with LeafletJS or exported to GeoJSON. Data will be cached in the browser memory.
35 lines (29 loc) • 785 B
JavaScript
module.exports = class EvaluatorPart {
compileLokiJS () {
return { needMatch: true }
}
isSupersetOf (other) {
if (JSON.stringify(this) === JSON.stringify(other)) {
return true
}
if (other.op === '||') {
return this.isSupersetOf(other.left) && this.isSupersetOf(other.right)
} else if (other.op === '&&') {
return this.isSupersetOf(other.left) || this.isSupersetOf(other.right)
} else if (other.fun === 'and') {
return other.parameters.some(p => this.isSupersetOf(p))
}
}
simplify () {
return this
}
cacheDescriptors (descriptors) {
descriptors.forEach(d => {
d.filters += this.toString({})
d.properties |= this.calcRequestProperties()
})
}
calcRequestProperties () {
return 0
}
}