The steps you need to follow to complete this recipe are as follows:
- Check how many hotspots there are for each distinct country by using the following query:
postgis_cookbook=> SELECT c.country_name, MIN(c.iso2) as iso2, count(*) as hs_count FROM chp01.hotspots as hs JOIN chp01.countries as c ON ST_Contains(c.the_geom, hs.the_geom) GROUP BY c.country_name ORDER BY c.country_name;
The output of the preceding command is as follows:
- Using the same query, generate a CSV file using the PostgreSQL COPY command or the ogr2ogr command (in the first case, make sure that the Postgre service user has full write permission to the ...