I have a PostGIS database filled with OSM data.
I would like to calculate the surface of impervious cover on a given subfraction of my database.
I have tried a more complex version of this query :
SELECT SUM(way_area)
FROM planet_osm_polygon
WHERE
natural <> ''
AND way && st_transform(
st_setsrid(
st_makebox2d(
st_point(2.283459561545372, 51.070047438454615),
st_point(2.2863346738544466, 51.07292255076369)
), 4326
), 3857
)
;
I get this error :
ERROR: syntax error at or near "<>"
LINE 1: ...um(way_area) from planet_osm_polygon where natural<>'' and w...
Trying to understand why, I tried to query for distinct natural
and get a similar error.
Those queries work fine if I replace natural by surface or building. Natural is one of the column of my base and the OSM wiki agrees that it has polygon values, so where does that error come from and how do I access the data in there?
3857
is not suitable for area computation, and you will want to double check that there is no overlap between the polygons, else you would have to first compute the union of the polygons.