[gdal-dev] Questions about SQL cursors in GDAL driver
Jorge Arévalo
jorge.arevalo at gmail.com
Sat Jul 11 03:45:04 EDT 2009
2009/7/11 Frank Warmerdam <warmerdam at pobox.com>:
> Jorge Arévalo wrote:
>>
>> So, clearly, I have a mistake. Think in a table with tiles of 100x100
>> px. We have 30 tiles. When I create RasterBands, their block size will
>> be 100x100. So, IReadBlock(0, 0, bufffer) indicates the block going
>> from (0, 0) to (100, 100). Does it mean that the block from (0, 0) to
>> (100, 100) must be the first one in the table if I get the rows
>> ordered by rid?
>
> No, I do not see how you could depend on this.
OK, understood.
>
>> It depends on how the tiles have been loaded. So,
>> instead of making hypothesis, Should I query the block that matchs the
>> extent from (0, 0) to (100, 100)?
>
> Yes, but furthermore, you will need to transform the pixel bounds into
> georeferenced coordinates to do the spatial query. I would also note that
> you might be best to reduce the query rectangle to just be a small central
> area of the tile to avoid fetching adjacent tiles or even forcing
> postgres to fetch them to check their bounds against your point. Spatial
> index tend to have a certain granularity.
I can get the center pixel coordinates of the block, transform them
into georeferenced coordinates (a point) and test which tile's
envelope contains this point. Right?
Many thanks again
Best regards
Jorge
More information about the gdal-dev
mailing list