Questions tagged [postgis-raster]

PostGIS Raster is a PostGIS data type for storing and analyzing raster data.

Filter by
Sorted by
Tagged with
3
votes
1answer
698 views

Replacing pixel value by lookup table using PostGIS?

I was wondering if it is possible to write a PostgreSQL statement to replace the value of each pixel in an input PostGIS-raster with a value obtained from a look up table. For example, suppose I have ...
1
vote
0answers
37 views

Storing raster imagery in PostgreSQL

I have a number of raster files saved locally which I use for basemapping in QGIS. I have built virtual raster fields to load these in one go but I'm looking to store them within my PostgreSQL ...
3
votes
1answer
2k views

Importing GeoTIFF into PostGIS without raster2pgsql?

I know that one can import GeoTIFF into PostGIS via raster2pgsql. I was wondering if there is any easy way (as a sequence of SQL statements) to do the same without resorting to the command line tool? ...
2
votes
1answer
135 views

Group raster data by values in a second raster

I am looking for a PostGIS equivalent to the ArcGIS Zonal Statistics by Table function. I have two rasters. I would like to group the data in the second raster by the values in the first raster, and ...
21
votes
3answers
7k views

Poor performance with storing large rasters in PostGIS and visualising in QGIS

my question concerns the use and performance of several software tools in conjunction, namely PostgreSQL, PostGIS, QGIS, and GDAL. I'm a long-time ArcGIS, Python, and R user who is interested in ...
0
votes
0answers
157 views

Different pixel values for a raster between QGIS and PostGIS

I have inserted a Landsat raster into PostGIS using the command : raster2pgsql -I -C -s 28356 -M -t 100x100 /data/LS7_20150425_B40.tif public.red | psql -d postgres -U postgres Using QGIS, I have ...
1
vote
0answers
23 views

How to insert raster and other columns using raster2pgsql?

I would like to have a table with a few more columns than just the raster data. Let's say I'd like to have anotherColumn. I tried raster2pgsql -s 3857 -R -a -k -f public.table.image -q -e -F -X ...
2
votes
1answer
44 views

return only one value per point from ST_Value() - currently returning 2 values for some points

I'm testing a point sample query with a subset of 5 points on a single band elevation raster. Using my usual approach (which I've previously not noticed this behavior), I get six records returned: ...
1
vote
1answer
221 views

Display simple raster file in openlayers

I have raster files (one sample can download from here) just have values for points and in beside i have top-left and bottom-right geo data and pixel size of file. so i want to just simply display ...
1
vote
0answers
60 views

How to use custom PostgreSQL schema with GeoServer ImageMosaic JDBC?

I have already created a raster layer in the postgres default 'public' schema and published it in GeoServer through the ImageMosaic JDBC. This is working fine but I would like to use a new custom ...
1
vote
1answer
25 views

Why does rescaling by 1.0 speed up this PostGIS query

To preface, I'm not sure if it matters, but I'm using PostgreSQL 11 with PostGIS 2.5 (through Docker on Windows) and accessing it with Python through PsycoPG2. My raster has the recommended index on ...
13
votes
1answer
426 views

PostGIS raster summation (map algebra)

I have a table of polygons representing travel time isochrones on particular days. For each origin point, there are five isochrone geometries (stored in separate rows). For each origin point, I want ...
2
votes
0answers
105 views

Error Quantifying Land Cover Classes by Polygon in PostGIS

I am trying to ultimately calculate proportion of land cover types by polygon in PostGIS, so starting using st_valuecount to get counts of pixels with different land cover types. The data are pretty ...
1
vote
0answers
83 views

Query PostGIS raster table in QGIS

I would like to know if it is possible to query a PostGIS raster directly in QGIS in the same way one can use the query builder to filter a vector layer? I have successfully built database views of ...
0
votes
1answer
48 views

PostGIS ST_RECLASS using Lookup Table not working properly

Link to question/answer similar to what I am trying to do I am trying to run ST_RECLASS on a raster to retain certain pixel values while setting others to NoData(0). I have a function that creates a ...
4
votes
1answer
402 views

unable to render/view a postgis raster in qgis 2.14.1

I have successfully added a raster to postgis using the following: raster2pgsql -s 4326 -I -C -M 00N_030E.tif -F -t 250x250 -a test.00N_030E | psql -U postgres -d raster -h localhost -p 5432 I tried ...
3
votes
1answer
159 views

ST_Clip tiled raster using geometry results in out of geometry pixels

I'm trying to run an ST_Clip for a simple AOI geometry. I'm using this WGS84 raster, imported into PostGIS like so: raster2pgsql -t 100x100 -C -M -F -I -s 4326 Hansen_GFC-2016-v1.4_lossyear_20S_070W....
0
votes
1answer
164 views

Error while importing geotiff file into postgresql database in linux platform

I am trying to import GeoTIFF file into spatially enabled PostgreSQL database. Using command: raster2pgsql -s 4326 -C -F -a path/to/geotiff/file public.table_name | psql -d database_name -U ...
2
votes
0answers
80 views

Postgis ST_NearestValue() returns nothing

My query in (Dutch SRID, in meter): SELECT ST_NearestValue(ahn.rast, 1, ST_SetSRID(ST_Point(135742.6965165309,453864.2795337387), 28992) FROM ahn2.ahn WHERE ST_Intersects(ahn.rast, ST_SetSRID(...
6
votes
0answers
1k views

Uploading raster format(*.tif) to postgis through raster2pgsql

I'm new to postgis and raster file format. i currently working on netcdf files and i want to import it into postgis through curl command line tool but its failed for me.so i jump on to GDAL v1.9.2 ...
1
vote
0answers
222 views

GUI for raster uploads to PostGIS/PostgreSQL

We can currently upload raster data with raster2pgsql to our PostgreSQL db. I am wondering if anyone is working on a GUI or plugin, maybe even through QGIS, that would make the raster upload ...
0
votes
1answer
179 views

PostGIS intersect query: Raster footprints of multiple high resolution GeoTIFF's or not? [closed]

I have multiple (381) high resolution GeoTIFF's (2x2 meter resolution, 1 band, 700 MB each) that I somehow want to upload to a PostGIS-server to be able to run ST_intersects or ST_3Dintersects queries ...
3
votes
1answer
516 views

How to speed up raster/map algebra in PostGIS?

I am testing map algebra with PostGIS (2.1 with PostgreSQL 9.3) on two images, and found it to be rather slow. For example, dividing two images of 7200 * 3600 pixels took 110 ~ 120s on a desktop with ...
1
vote
1answer
212 views

Average of multiple rasters in PostGIS raster?

I am trying to calculate the average of multiple rasters stored as raster datatype in PostGIS enabled database. The rasters are stored in three different tables (spi3, sri3, and smdi) and have date as ...
1
vote
0answers
59 views

Stacking rasters of different resolutions in PostGIS

I have three rasters covering the same area but with different pixel sizes (Sentinel 2 tiles if it matters). My goal is to "stack" them, such that pixel[i,j] in the resulting raster contains [bands ...
0
votes
0answers
168 views

3d Intersect query compatible with GeoTIFF/DEM?

When researching this topic I haven't been able to verify if it's possible to make spatial 3D Intersect queries between a vector polygon with z-values and GeoTIFF/DEM file holding the elevation values?...
2
votes
0answers
89 views

Loading raster to R from PostgreSQL via pgGetRast takes a lot of time

I wrote R code in R Studio to load a raster (stored in PostgreSQL) to R. The database is stored here: C:\Program Files\PostgreSQL\ The following versions are installed on the computer: R version 3.4....
1
vote
0answers
73 views

Using postgis to rasterize a set of points grouping by time

I have used postgis for vector operations for years, but have recently begun a project mixing vector and raster data and I am bit confused as to what is the best way to do what I want to do. I have ...
6
votes
0answers
319 views

PostGIS issue with ST_Clip?

I'm trying to clip a raster using a polygon but I end up with a result that doesn't seem right and where some raster pixels are outside the polygon used for the clip. See image below where polygon is ...
1
vote
0answers
75 views

Sample overlapping rasters in PostGIS

UPDATE: The SQL below works fine. My problem was a newbie mistake in using the Python psycopg2 functions to execute it. So I think I should just delete this question. ORIGINAL QUESTION: I have a ...
2
votes
1answer
160 views

How to write quotes in PG connection string in where clause when open Postgis Raster?

I have some rasters in PostGIS and I want to open just those which match to where clause. How can I do that? I have tried: ds = gdal.Open("PG:host=<host> dbname=<dbname> table=<...
5
votes
2answers
440 views

Calculating Slope for the Whole World in PostGIS

The Challenge I have a PostGIS Database which contains all of SRTM v4.1. I need to calculate slope for the entire globe as part of an error modeling process. The DEM is tiled at 100x100. Whenever I ...
6
votes
1answer
511 views

Set Z value to a linestring from a postgis raster

I have a table with multilinestring geometries that can be updated or inserted by external users, and a raster table with elevation values. I want to write a trigger that sets the z value of each ...
1
vote
1answer
421 views

How to query with stored PostGIS time series raster data

I have time series raster data in PostGIS and I can't find a way to get the info as a time series from an XY point. For example: I would like to get the vale of the XY point in raster for the 13/08/...
12
votes
2answers
3k views

Downloading raster data into python from postgis using psycopg2

I have raster data in a postgres table that I want to get into python as a numpy array. I am using psycopg2 to connect to the db. I am able to download the data but it comes back as a string (probably ...
4
votes
0answers
54 views

Why do I get a memory allocation error when selecting rasters by ID in PostGIS?

The Problem I have about 256000 tiles in a table of GDEM v2 at 1 arcsecond resolution. I'm on an Ubuntu server running Postgres 9.5.5 and PostGIS 2.2. The table has a GIST index on the convex hull of ...
3
votes
2answers
341 views

Rasterizing vector layer with PostGIS?

I have a vector layer with 2498 features (houses) that I want to rasterize/produce a raster image from but can't figure out how: Column MARK_Z = is Meters above see-level for the base of each ...
4
votes
1answer
465 views

postgis resampling two rasters to a common grid system?

I am testing the PostGIS map algebra (ST_MapAlgebra) on two different raster tables. Each table contains a single image/row. They have the same SRID but different, overlapping extents and different ...
1
vote
1answer
105 views

R Script for Computing Image Means and Raster Value Subtractions

I have a very specific script I am trying to make which computes image flatfields. Basically, I am computing a Master Dark Frame (MD) by averaging a set of Dark Photos. I have a set of light photos ...
2
votes
1answer
346 views

Color of extent in OpenLayers 3

I'm very new to OpenLayers and all the GIS world. I'm working with rasters (tiff that are converted to postgis sql) I have this code: var feature; $.ajax({ method: "POST"...
1
vote
1answer
383 views

How to perform slope using PostGIS?

I want to perform Slope using PostGIS. I used this query but I got a strange result unit: create table my_slope as SELECT ST_Slope(rast,1,'32BF','PERCENT',1, false) as slope FROM my_raster I wonder ...
1
vote
1answer
225 views

Why is pgraster much slower?

This is a follow up question to my other question: How to speed up raster/map algebra in PostGIS? I am much attracted to the way how PostGIS handle vectors and rasters in an interoperable manner. A ...
1
vote
0answers
290 views

504 Gateway Timeout only with 1 kind of mapserver request (TileWMS in OpenLayers 3) [closed]

I'm very new to GIS. With MapServer, I'm calling four kinds of data, but only with this one am I having some HTTP 504 error message randomly. The other three never have that error, but only with this ...
1
vote
1answer
190 views

Can rasters in same CONSTRAINED table have different alignments in PostGIS?

Context I have a table filled with ASTER GDEM data for the state of Colorado tiled at 100x100 pixels. I want to query the table and return a single raster that covers all of the supplied bounding box ...
4
votes
1answer
620 views

Selecting all pixels above a given value in a raster in PostGIS

I have a raster with one band whose value represents the date of the occurrence (a sequential integer). This raster file gets updated regularly, and each time that happens, I need to run a process ...
0
votes
1answer
187 views

ST_Value, multiple rasters - need unique columns for rast values

I have a grid of cells that I am converting to centroids to 'sample' raster values in the same locations as the centroids. All rasters (4) are in the same table with same resolution and SRID. I want ...
3
votes
1answer
233 views

PostGIS ST_AsPNG faster than ST_PixelAsCentroids

I'm hoping to export a PostGIS raster into a non-GIS enabled database. Ideally, I'd like to be able to have three columns in the output: latitude, longitude, raster_value. Easy enough. Ideally, I'd ...
0
votes
1answer
140 views

postgis SRTM3 different raster scale in same column

SRTM3 elevation data are stored in HGT files each containing 1201x1201 values. I want to store this information in a PostGIS raster column with a single band. To optimize my queries, I wanted to ...
6
votes
0answers
581 views

PostGIS: Storing large gridded time series

I'm trying to store a large raster timeseries on PostGIS-2.2 / PostgreSQL 9.5. The data comes as a collection of HDF-EOS (basically HDF4) files. Each file contains 24 bands, representing hourly ...
1
vote
1answer
260 views

PostGIS: ST_Clip problem with area which oversteps the raster

Hello all the PostGIS wizards! I want to programmatically clip raster with bounding box which is overstepping the border of raster. Ok, i can do it with ST_Clip, but the problem is that ST_Clip only ...