make a map of your TPG photo scores
in just a few easy far too many far too complex steps
- Make a Postgres database with PostGIS
- Add a
photos
table:CREATE TABLE photos(id SERIAL PRIMARY KEY, title VARCHAR(255), location geography(POINT, 4326) NOT NULL); CREATE INDEX photos_location ON photos USING GIST(location);
- Load your photo locations into the
photos
table - Make a
graticule
table:create table graticule(geom geography(point,4326) not null); insert into graticule(select st_point(lng,lat)::geography from generate_series(-90,90,0.1) as lat, generate_series(-180,180,0.1) as lng);
- Compute the best photo for every point on the graticule:
create table raster as select graticule.geom, b.dist,b.id from graticule cross join lateral (select location <-> graticule.geom dist, id from photos order by dist limit 1) as b ;
- Download the data to your local working directory:
\copy (select st_x(geom::geometry),st_y(geom::geometry),dist from raster) to 'raster2.csv' csv;
- Rename
raster2.csv
toraster2.xyz
- Convert to a TIFF, using
gdal_translate
from GDAL:gdal_translate -a_srs EPSG:4326 raster2.xyz raster2.tiff
- Using QGIS or another tool of your choice, add the resulting TIFF as a raster layer to a new project.
- Make it pretty, I guess