const POLYGON = [ {long: 9.167607, lat: 48.778201}, {long: 9.185958, lat: 48.769639}, {long: 9.207777, lat: 48.773653}, {long: 9.236923, lat: 48.790480}, {long: 9.219015, lat: 48.805266}, {long: 9.203548, lat: 48.817967}, {long: 9.172679, lat: 48.811559}, ]; const POLYGON_STR = POLYGON.concat([POLYGON[0]]) .map(location => [location.long, location.lat]) .map(p => `${p[0]} ${p[1]}`).join(","); const POLYGON_STR_REVERSED = POLYGON.concat([POLYGON[0]]) .map(location => [location.long, location.lat]) .map(p => `${p[1]} ${p[0]}`).join(","); export const ST_WITHIN_FILTER = "st_within(feature, geography'POLYGON " + `((${POLYGON_STR}))')`; export const ST_WITHIN_FILTER_REVERSED = "st_within(feature, geography'POLYGON " + `((${POLYGON_STR_REVERSED}))')`;