#502 closed enhancement (wontfix)
[raster] Optimize ST_Intersection to return ST_Value when intersecting with points
Reported by: | pracine | Owned by: | pracine |
---|---|---|---|
Priority: | low | Milestone: | PostGIS Fund Me |
Component: | raster | Version: | master |
Keywords: | Cc: |
Description (last modified by )
It might be much quicker to provide the value associated with a pixel intersecting with a point geometry when using ST_Intersection() by accessing the pixel value with ST_Value instead of vectorizing the whole tile. We have first to fix st_value(rast, geom) so it behave exactly as st_intersect on edge of raster and pixels.
This, obviously, do not work when the intersecting geometry is a line or a polygon. In this case we should try to vectorize only the intersecting part of the raster tile.
Change History (15)
comment:1 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 14 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Actually no. it was not adressed. To do...
comment:3 by , 14 years ago
Description: | modified (diff) |
---|---|
Summary: | [wktraster] Optimize ST_Intersection when the geometry is a point → [wktraster] Optimize ST_Intersection |
comment:4 by , 14 years ago
Milestone: | WKTRaster 0.1.6 → PostGIS 2.0.0 |
---|---|
Owner: | changed from | to
Status: | reopened → new |
Summary: | [wktraster] Optimize ST_Intersection → [wktraster] Optimize ST_Intersection to return ST_Value when intersecting with points |
comment:5 by , 14 years ago
Status: | new → assigned |
---|
comment:6 by , 14 years ago
Summary: | [wktraster] Optimize ST_Intersection to return ST_Value when intersecting with points → [raster] Optimize ST_Intersection to return ST_Value when intersecting with points |
---|
comment:7 by , 14 years ago
Priority: | medium → low |
---|---|
Type: | defect → enhancement |
comment:8 by , 14 years ago
For this we need ST_Value to behave like ST_Intersection by returning a SET OF 2 or 4 values when the requested coordinated fall between two pixels or four pixels.
Actually it is more the opposite: The ST_Value variant taking a point geometry should be "downtimized" (only 3 occurrence in Google !!) as a wrapper around ST_Intersection so that when a point located the intersection of 2 or 4 pixels is passed, the function returns 2 or 4 values since the right behavior is the one of ST_Intersection in this case. For sure this would make this variant of ST_Value much slower since ST_Intersection has to polygonize the tile first which ST_Value do not do right now (it converts the point to a x and a y raster coordinate and returns the value at this coordinate).
To make it to be fast, we must then first optimize ST_Intersection by being able to polygonize a subregion of the tile (the one intersecting with the geometry). This would generally optimize ST_Intersection for any geometry. In the case of ST_Value this region would reduce to a maximum of 4 pixels and hence would be quite fast.
It is already possible to pass a mask to the GDAL polygonize function. That mean we could construct a mask with the area we want to polygonize. Would this be fast? For sure it would be more efficient to be able to just pass x1,y2, x2,y2 to the function to delimitate this area. To see with GDAL people.
comment:9 by , 14 years ago
Pierre,
Actually I rather liked the way ST_Value worked returning only one value. Its convenient in many cases. If you are going to have it return multiple -- then call it ST_values and please leave ST_Value alone. Like for example when I'm grabbing an elevation as a rule of thumb -- I really only want one value. If you must consider all pixels then average them.
follow-up: 11 comment:10 by , 14 years ago
I'm still thinking anout it and consult our big PostGIS raster lidar freak user here (Etienne) to try to find the best options possible. At a first glance:
-There should be an option saying to ST_Value should return nodata value as NULL or nodata value. NULL by default.
-There should be an option to specify which one of the four pixel value to return when the point geometry falls on the edge of 2 or more pixels.
-ST_Value should continue to return only one value; use ST_Intersection if you want a vector-like behavior with pixel edges (i.e. possibly many values).
comment:11 by , 14 years ago
The options in the second case would be 'UL', 'UR', 'LL', 'LR' for upper left, upper right, lower left, lower right. The default would be 'LL' like it is right now (I have to verify).
comment:12 by , 14 years ago
Milestone: | PostGIS 2.0.0 → PostGIS Raster Future |
---|
comment:13 by , 13 years ago
Milestone: | PostGIS Raster Future → PostGIS Future |
---|
comment:14 by , 12 years ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
Adressed in r5687