By digoal
Raster data is image data composed of lattices, which have the spatial property (boundary). A lattice is composed of pixels. Therefore, each pixel also has a spatial property. Moreover, each pixel is filled with values representing factors such as temperature, grayscale, hue, saturation, and brightness.
Each raster can have multiple bands. Each band can represent a layer, and various bands can be combined and superimposed for calculation.
Raster data allows analyzing and visualizing data with a spatial or business property — for example, heatmap data, greening rate maps, road distribution, and temperature distribution.
The structure of ArcGIS raster data is as follows:
When a pixel’s value is extracted, some performance issues may occur because raster data can be large or small.
When the raster file is very large, it may take a long time to execute the ST_Value Function, although only one pixel’s value is extracted.
The performance of this step is related to the data structure and retrieval method of the raster file.
Learn about raster objects from the ArcGIS or PostGIS documents:
1) Split a large raster object into several smaller objects.
2) Convert the boundary into a geometry point and create an expression index on the boundary.
3) Check whether the input geometry point intersects the raster being queried (ST_Intersects). If yes, calculate ST_Value. If no, do not calculate ST_Value.
Another optimization method is establishing a better data model for raster files that can facilitate fast searches, which is transparent to business systems.
The optimization methods are as follows:
1) Split a large raster object into several small objects to reduce the computing resource consumption.
2) Use expression indexes to reduce the computing resource consumption or I/O amplification.
3) Reduce accuracy and stratify raster objects.
SELECT
ST_AsText(ST_Union(pixpolyg)) As shadow
FROM
(
SELECT ST_Translate(
ST_MakeEnvelope(
ST_UpperLeftX(rast),
ST_UpperLeftY(rast),
ST_UpperLeftX(rast) + ST_ScaleX(rast)*2,
ST_UpperLeftY(rast) + ST_ScaleY(rast)*2,
0
),
ST_ScaleX(rast)*x,
ST_ScaleY(rast)*y
) As pixpolyg,
ST_Value(rast, 2, x, y) As b2val
FROM
dummy_rast
CROSS JOIN
generate_series(1,1000,2) As x
CROSS JOIN
generate_series(1,1000,2) As y
WHERE rid = 2
AND x <= ST_Width(rast)
AND y <= ST_Height(rast)
) As foo
WHERE
ST_Intersects(
pixpolyg,
ST_GeomFromText('POLYGON((3427928 5793244,3427927.75 5793243.75,3427928 5793243.75,3427928 5793244))',0)
)
AND b2val != 254;
PostgreSQL: How to Determine the Positions of Overlapping Points and Planes in PostGIS
digoal - December 18, 2020
Alibaba Clouder - July 26, 2019
ApsaraDB - October 8, 2024
Alibaba Clouder - March 22, 2019
ApsaraDB - January 19, 2024
Alibaba Clouder - July 26, 2019
Alibaba Cloud PolarDB for PostgreSQL is an in-house relational database service 100% compatible with PostgreSQL and highly compatible with the Oracle syntax.
Learn MoreLeverage cloud-native database solutions dedicated for FinTech.
Learn MoreMigrate your legacy Oracle databases to Alibaba Cloud to save on long-term costs and take advantage of improved scalability, reliability, robust security, high performance, and cloud-native features.
Learn MoreMigrating to fully managed cloud databases brings a host of benefits including scalability, reliability, and cost efficiency.
Learn MoreMore Posts by digoal