Re: [gdal-dev] Censor area in tiles of aerial image

2024-03-19 Thread Frank Warmerdam via gdal-dev
Carsten,

gdal_rasterize definitely supports burning into existing files.

I'm not sure about the configuration of your raster -- some formats are not
updatable-in-place, but the limitation isn't in gdal_rasterize.

Best regards,
Frank

On Tue, Mar 19, 2024 at 8:42 AM Carsten Lockenkötter <
carsten.lockenkoet...@web.de> wrote:

> Hi Frank,
>
> I have read about gdal_rasterize but it seems it works a bit different as
> i need it.
> Gdal_rasterize converts a vector layer to a raster layer with specific
> dimensions and create a new file, like a mask.
> It could be work for me yes, because i publish the raster files as image
> mosiac at the geoserver.
> Maybe the new "mask" file overlays on me original files and the created
> wmts tiles of the geoserver could contain the mask.
>
> I will try it, but is there another option to burn the vectorlayer into
> existing tiles?
>
> Regards,
> Carsten
> Am 19.03.24, 00:14 schrieb Frank Warmerdam :
>
>> Carsten,
>>
>> The gdal_rasterize command allows you to "burn in" polygons from an OGR
>> supported datasource into an existing raster.  If your raster is a 3 band
>> RGB file, you could use --burn 100 150 200 to burn in the RGB value
>> (100,150,200).   This will only work if the raster format you are using
>> supports update-in-place.
>>
>> You would have to regenerate pyramids after this process -- they are not
>> automatically updated by GDAL when the "base layer" is updated.
>>
>> Best regards,
>> Frank
>>
>>
>> On Mon, Mar 18, 2024 at 5:34 PM Carsten Lockenkötter via gdal-dev <
>> gdal-dev@lists.osgeo.org> wrote:
>>
>>> Hi,
>>>
>>>
>>>
>>> is it possible to censor specific areas of an aerial image using GDAL?
>>>
>>>
>>>
>>> I have several smaller tiles that I've already transformed into my
>>> desired coordinate system and generated internal pyramids.
>>>
>>> Subsequently, I would like to censor certain areas based on polygons
>>> (e.g., from a shapefile or an Oracle DB) (coloring them grayish).
>>>
>>> Set the color must be done after transforming coordinatesystem and
>>> generating pyramids.
>>>
>>>
>>>
>>> I usually use the compiled Windows binaries from gisinternals.com.
>>>
>>> Presumably, my plan doesn't work with that, right? At least I haven't
>>> found anything in that direction.
>>>
>>> I suppose this could be done with a Python, but I've never worked with
>>> Python before.
>>>
>>> Do I need to adjust the internal pyramids as well? Or do I have to
>>> recreate them?
>>>
>>>
>>>
>>> Could you please show me a brief example of how it could work, so I have
>>> an approach?
>>>
>>> I just need an idea of how to implement this and possibly some tips on
>>> what else I need to consider.
>>>
>>>
>>>
>>> Regards,
>>>
>>> Carsten
>>> ___
>>> gdal-dev mailing list
>>> gdal-dev@lists.osgeo.org
>>> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>>>
>>
>>
>> --
>>
>> ---+--
>> I set the clouds in motion - turn up   | Frank Warmerdam,
>> warmer...@pobox.com
>> light and sound - activate the windows | USA: +1 650-701-7823
>> 
>> and watch the world go round - Rush| CAN: +1 343-550-9984
>>
>

-- 
---+--
I set the clouds in motion - turn up   | Frank Warmerdam,
warmer...@pobox.com
light and sound - activate the windows | USA: +1 650-701-7823

and watch the world go round - Rush| CAN: +1 343-550-9984
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] Censor area in tiles of aerial image

2024-03-19 Thread Even Rouault via gdal-dev

Why not just trying?

Demo:

$ gdal_create -outsize 10 10 -burn 255 test.tif -a_srs EPSG:4326 -a_ullr 
0 10 10 0
$ gdal_rasterize -burn 0 
'{"type":"Polygon","coordinates":[[[2,2],[2,4],[4,4],[4,2],[2,2]]]}' 
test.tif

$ gdal_translate test.tif /vsistdout/ -of aaigrid
ncols    10
nrows    10
xllcorner    0.
yllcorner    0.
cellsize 1.
255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255
255 255 0 0 255 255 255 255 255 255
255 255 0 0 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255

That said, I've attempted to clarifiy it pe 
https://github.com/OSGeo/gdal/commit/4377ce22ec8d26b76760e8c1e4a9ffa2bd240b7d


Le 19/03/2024 à 13:42, Carsten Lockenkötter via gdal-dev a écrit :

Hi Frank,

I have read about gdal_rasterize but it seems it works a bit different 
as i need it.
Gdal_rasterize converts a vector layer to a raster layer with specific 
dimensions and create a new file, like a mask.
It could be work for me yes, because i publish the raster files as 
image mosiac at the geoserver.
Maybe the new "mask" file overlays on me original files and the 
created wmts tiles of the geoserver could contain the mask.


I will try it, but is there another option to burn the vectorlayer 
into existing tiles?


Regards,
Carsten
Am 19.03.24, 00:14 schrieb Frank Warmerdam :

Carsten,

The gdal_rasterize command allows you to "burn in" polygons from
an OGR supported datasource into an existing raster.  If your
raster is a 3 band RGB file, you could use --burn 100 150 200 to
burn in the RGB value (100,150,200).   This will only work if the
raster format you are using supports update-in-place.

You would have to regenerate pyramids after this process -- they
are not automatically updated by GDAL when the "base layer" is
updated.

Best regards,
Frank


On Mon, Mar 18, 2024 at 5:34 PM Carsten Lockenkötter via gdal-dev
 wrote:

Hi,

is it possible to censor specific areas of an aerial image
using GDAL?

I have several smaller tiles that I've already transformed
into my desired coordinate system and generated internal pyramids.

Subsequently, I would like to censor certain areas based on
polygons (e.g., from a shapefile or an Oracle DB) (coloring
them grayish).

Set the color must be done after transforming coordinatesystem
and generating pyramids.

I usually use the compiled Windows binaries from
gisinternals.com .

Presumably, my plan doesn't work with that, right? At least I
haven't found anything in that direction.

I suppose this could be done with a Python, but I've never
worked with Python before.

Do I need to adjust the internal pyramids as well? Or do I
have to recreate them?

Could you please show me a brief example of how it could work,
so I have an approach?

I just need an idea of how to implement this and possibly some
tips on what else I need to consider.

Regards,

Carsten

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev



-- 
---+--

I set the clouds in motion - turn up   | Frank Warmerdam,
warmer...@pobox.com
light and sound - activate the windows | USA: +1 650-701-7823
and watch the world go round - Rush    | CAN: +1 343-550-9984


___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


--
http://www.spatialys.com
My software is free, but my time generally not.
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] Censor area in tiles of aerial image

2024-03-19 Thread Even Rouault via gdal-dev

Thomas,

Le 19/03/2024 à 08:26, thomas bonfort via gdal-dev a écrit :
I have a side-question concerning the update-in-place behavior of the 
gtiff driver in this case: given that a compressed strile will nearly 
always be smaller after this update (due to better compression ratios 
on the uniform area), will libtiff overwrite the previous strile in 
place also, or will it be appended to the existing file (resulting in 
a larger final file size)?


If the updated tile/strip occupies a smaller size than its previous 
version, it will overwrite in place. Note however that it will not wipe 
out the bytes that are no longer used, which might potentially be an 
issue in the context of censoring. Thus I would recommend doing a final 
gdal_translate to get a "clean" version before distributing it.


Even

--
http://www.spatialys.com
My software is free, but my time generally not.
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] Censor area in tiles of aerial image

2024-03-19 Thread thomas bonfort via gdal-dev
I have a side-question concerning the update-in-place behavior of the gtiff
driver in this case: given that a compressed strile will nearly always be
smaller after this update (due to better compression ratios on the uniform
area), will libtiff overwrite the previous strile in place also, or will it
be appended to the existing file (resulting in a larger final file size)?
regards,
TB

Le mar. 19 mars 2024, 00:15, Frank Warmerdam via gdal-dev <
gdal-dev@lists.osgeo.org> a écrit :

> Carsten,
>
> The gdal_rasterize command allows you to "burn in" polygons from an OGR
> supported datasource into an existing raster.  If your raster is a 3 band
> RGB file, you could use --burn 100 150 200 to burn in the RGB value
> (100,150,200).   This will only work if the raster format you are using
> supports update-in-place.
>
> You would have to regenerate pyramids after this process -- they are not
> automatically updated by GDAL when the "base layer" is updated.
>
> Best regards,
> Frank
>
>
> On Mon, Mar 18, 2024 at 5:34 PM Carsten Lockenkötter via gdal-dev <
> gdal-dev@lists.osgeo.org> wrote:
>
>> Hi,
>>
>>
>>
>> is it possible to censor specific areas of an aerial image using GDAL?
>>
>>
>>
>> I have several smaller tiles that I've already transformed into my
>> desired coordinate system and generated internal pyramids.
>>
>> Subsequently, I would like to censor certain areas based on polygons
>> (e.g., from a shapefile or an Oracle DB) (coloring them grayish).
>>
>> Set the color must be done after transforming coordinatesystem and
>> generating pyramids.
>>
>>
>>
>> I usually use the compiled Windows binaries from gisinternals.com.
>>
>> Presumably, my plan doesn't work with that, right? At least I haven't
>> found anything in that direction.
>>
>> I suppose this could be done with a Python, but I've never worked with
>> Python before.
>>
>> Do I need to adjust the internal pyramids as well? Or do I have to
>> recreate them?
>>
>>
>>
>> Could you please show me a brief example of how it could work, so I have
>> an approach?
>>
>> I just need an idea of how to implement this and possibly some tips on
>> what else I need to consider.
>>
>>
>>
>> Regards,
>>
>> Carsten
>> ___
>> gdal-dev mailing list
>> gdal-dev@lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>
>
> --
>
> ---+--
> I set the clouds in motion - turn up   | Frank Warmerdam,
> warmer...@pobox.com
> light and sound - activate the windows | USA: +1 650-701-7823
> 
> and watch the world go round - Rush| CAN: +1 343-550-9984
> ___
> gdal-dev mailing list
> gdal-dev@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] Censor area in tiles of aerial image

2024-03-18 Thread Frank Warmerdam via gdal-dev
Carsten,

The gdal_rasterize command allows you to "burn in" polygons from an OGR
supported datasource into an existing raster.  If your raster is a 3 band
RGB file, you could use --burn 100 150 200 to burn in the RGB value
(100,150,200).   This will only work if the raster format you are using
supports update-in-place.

You would have to regenerate pyramids after this process -- they are not
automatically updated by GDAL when the "base layer" is updated.

Best regards,
Frank


On Mon, Mar 18, 2024 at 5:34 PM Carsten Lockenkötter via gdal-dev <
gdal-dev@lists.osgeo.org> wrote:

> Hi,
>
>
>
> is it possible to censor specific areas of an aerial image using GDAL?
>
>
>
> I have several smaller tiles that I've already transformed into my desired
> coordinate system and generated internal pyramids.
>
> Subsequently, I would like to censor certain areas based on polygons
> (e.g., from a shapefile or an Oracle DB) (coloring them grayish).
>
> Set the color must be done after transforming coordinatesystem and
> generating pyramids.
>
>
>
> I usually use the compiled Windows binaries from gisinternals.com.
>
> Presumably, my plan doesn't work with that, right? At least I haven't
> found anything in that direction.
>
> I suppose this could be done with a Python, but I've never worked with
> Python before.
>
> Do I need to adjust the internal pyramids as well? Or do I have to
> recreate them?
>
>
>
> Could you please show me a brief example of how it could work, so I have
> an approach?
>
> I just need an idea of how to implement this and possibly some tips on
> what else I need to consider.
>
>
>
> Regards,
>
> Carsten
> ___
> gdal-dev mailing list
> gdal-dev@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>


-- 
---+--
I set the clouds in motion - turn up   | Frank Warmerdam,
warmer...@pobox.com
light and sound - activate the windows | USA: +1 650-701-7823

and watch the world go round - Rush| CAN: +1 343-550-9984
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev