Questions tagged [postgis-raster]

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

Filter by
Sorted by
Tagged with
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 ...
13
votes
1answer
430 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 ...
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 ...
6
votes
2answers
618 views

Is there an open standard for raster information?

For geographic vector data (Features) there is an OGC standard that defines geometries and their different annotations such as WKT and WKB. For raster image data however, I was not able to find ...
6
votes
1answer
526 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 ...
6
votes
1answer
1k views

Converting a PostGIS raster back to vector

Is it possible to convert a PostGIS raster back to a line? I'd like to generalize some vector data by converting it to raster and altering the cellsize to fix 'gaps' in the vector connectivity. Once ...
6
votes
0answers
322 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 ...
6
votes
0answers
601 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 ...
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 ...
5
votes
2answers
445 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 ...
4
votes
1answer
629 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 ...
4
votes
1answer
421 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 ...
4
votes
1answer
474 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 ...
4
votes
0answers
58 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 ...
4
votes
0answers
232 views

Counting nodata and data pixels using PostGIS

I'm using PostgreSQL 9.2.4 and PostGIS 2.0.3. I have some raster layer and I'm trying to get the count of all pixels (including nodata), cliped by polygon. Raster was imported by raster2sql: ...
3
votes
2answers
319 views

How to classify a raster using QGIS Plugin interacting with PostGIS?

I'm developing a QGIS plugin where users can enter some parameters (like distance, depth, area...) and by submiting the plugin interact with a PostGIS database and extract informations form vector and ...
3
votes
1answer
441 views

PostGIS raster - sum of rasters

I have raster data stored in a PostgreSQL/PostGIS database. I need to create a summed raster from certain rasters. Something like: select sum(raw_data) as image from data where rid > 2 AND rid &...
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? ...
3
votes
1answer
704 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 ...
3
votes
1answer
165 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....
3
votes
2answers
351 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 ...
3
votes
1answer
237 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 ...
3
votes
1answer
520 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 ...
3
votes
0answers
1k views

How to IDW interpolation in PostGIS

I'm trying to find PostGIS Raster functions supports the Inverse Distance Weighted interpolation method (IDW) and Kriging interpolation method. I'm especially trying to generate a temperature map ...
2
votes
1answer
326 views

Storing and updating large amount of raster data

Large amount of data = ~10TB of rasters (multiple projections) with the possibility of this data growing. The basic architecture I'm planning at the moment is having 2 clusters of GeoServer--one ...
2
votes
1answer
2k views

How to view a postgis raster query in QGIS

I have successfully loaded a large number of .asc images (>2800 200x200 tiles) into a Postgres table with PostGIS 2.1 support. The new table appears in QGIS's DB Manager and I can add the whole image ...
2
votes
1answer
166 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=<...
2
votes
1answer
2k views

How to connect PostGIS raster data to Geoserver?

The data I have used is DEM. It creates a table and has 2 columns in PostGIS. Is it necessary to create a new table again and follow the configuration process as mentioned in the Image Mosaic JDBC ...
2
votes
2answers
302 views

Is it possible to georeference raster stored in Postgis?

I'm looking to store a huge raster aerial image (400 Gb) into Postgis, but before storing it i like to know how i could georeference or rectify raster stored in postgis ? is there any Qgis plugins ...
2
votes
1answer
559 views

Create a raster with fixed 10meter pixel scale in PostGIS

I have a series of points that I would like to convert to a raster, and then calculate the area of the raster as a proxy for "amount of area covered". I'm trying to do this using PostGIS rather than ...
2
votes
1answer
30 views

Creating a raster with point count as cell value?

I have a PostGIS table with Point geometries in it. I want to create a raster object where each cell value is the number of points within a given raster cell. Cells with zero points in it can be 0, ...
2
votes
1answer
360 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"...
2
votes
1answer
386 views

PostGIS Raster performances

I ingested two Landsat images into PostGIS database using : raster2pgsql -I -C -s 28356 -M -t 100x100 LS7_20150425_B40.tif public.red | psql -d postgres -U postgres raster2pgsql -I -C -s 28356 -M -t ...
2
votes
1answer
655 views

How to get pixel values/cell values for stored raster files in postgis?

Raster files in tiff format are storing into database.However I gets only an attribute table. Is there any way to retrieve pixel values/cell values in the table. I have used raster2pgsql command for ...
2
votes
1answer
48 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: ...
2
votes
1answer
581 views

Issues with raster data on postgresql / error:Attempting to get pixel value with out of range raster coordinates

So here is the issue, i am trying to extract values from a big raster divided in 200 or so tiles and applying them to a selection. The points are startpoints, endpoints and midpoints from vector items,...
2
votes
0answers
111 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 ...
2
votes
0answers
83 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(...
2
votes
0answers
93 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....
2
votes
1answer
146 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 ...
2
votes
0answers
62 views

ST_ColorMap wrongly loses 0.0 value when INTERPOLATE

I want apply a colormap to a monoband grey scale tiff from postgis calling ST_ColorMap. My query is something like "SELECT oid, lowrite(lo_open(oid, 131072), tiff) As num_bytes " + "FROM ( ...
2
votes
0answers
130 views

Add bands or new raster column in Postgis?

Would it be faster to work with a new band or a new raster column for a raster dataset in Postgres with new pixel values, assuming that the size, extent and everything else relevant remains constant? ...
2
votes
0answers
310 views

How to perform spatial interpolation using PostGIS? [closed]

I need to interpolate some point data and would like to use the ST_InvDistWeight4ma function. As I am new to raster PostGIS, I would like to get some help about this.
2
votes
0answers
362 views

I am getting error in PostGIS 'function st_clip(raster, integer, geometry) does not exist'? [closed]

I have to find the count of the number of pixels in a given band of a clipped raster. For clipping, I am using ST_clip(). Through clip function raster is clipped with a polygon. I am getting ...
1
vote
1answer
431 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/...
1
vote
1answer
98 views

Is the PostGIS Raster primary key required to be named rid?

In all examples from the PostGIS Raster reference the primary key in tables with a raster column is named rid. I wonder if that naming is expected by any functionality of PostGIS itself or any client ...
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 ...
1
vote
1answer
218 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
1answer
233 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
1answer
265 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 ...