harden SQL queries for multi-layer-maps