[gdal-dev] [help][gdalwarp]Use of gdalwarp with data overlapping antimeridian

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] [help][gdalwarp]Use of gdalwarp with data overlapping antimeridian

chris Lav

Hello,

 

I’m using GDAL library in a C# project.

 

To reproject some geotiff files i’m calling gdalwarp tool as external process with this command:

 

gdalwarp.exe -s_srs EPSG:4326 -t_srs EPSG:3857 -dstalpha input.tiff output.tiff

 

 

All works fine except for data overlapping antimeridian such as the associated tiff file.

 

I don’t find how fix my problem or if I’m using the correct tool for those kind of data.

 

 

Best regards,

 

 

cid:image003.png@01D1FD34.3B7C8CC0

Christophe LAVOYE - Analyste
AKKA Technologies
Informatique & Systèmes
7 boulevard Henri Ziegler – 31700 BLAGNAC
Tél : +33 (0)5 36 25 15 40
Email :
[hidden email]

 

 


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: [help][gdalwarp]Use of gdalwarp with data overlapping antimeridian

Robert Coup
Hi Christophe,

What do you expect or want to happen with your images?

Are your 4326 image coordinates in -180° to +180° range (ie. the right longitude is < the left); or do they go past +180°?

3857 is a projected coordinate system, so doesn't have a builtin concept of wrapping. Some clients implement. 
Do you want x values >20037508.34? But they'll only display on the "right" side of the world then (if at all).

The simplest approach is likely to be to do two warp operations, for the left and right parts, ending up with two images — one with left=-20037508.34 and one with right=+20037508.34

Rob :)


On 1 March 2018 at 15:23, LAVOYE Christophe <[hidden email]> wrote:

Hello,

 

I’m using GDAL library in a C# project.

 

To reproject some geotiff files i’m calling gdalwarp tool as external process with this command:

 

gdalwarp.exe -s_srs EPSG:4326 -t_srs EPSG:3857 -dstalpha input.tiff output.tiff

 

 

All works fine except for data overlapping antimeridian such as the associated tiff file.

 

I don’t find how fix my problem or if I’m using the correct tool for those kind of data.

 

 

Best regards,

 

 

cid:image003.png@01D1FD34.3B7C8CC0

Christophe LAVOYE - Analyste
AKKA Technologies
Informatique & Systèmes
7 boulevard Henri Ziegler – 31700 BLAGNAC
Tél : <a href="tel:+33%205%2036%2025%2015%2040" value="+33536251540" target="_blank">+33 (0)5 36 25 15 40
Email :
[hidden email]

 

 


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev



--

Chief Technology Officer Koordinates

<a href="tel:+44%20759%209873480" target="_blank">+44 759 987 3480 / koordinates.com / @koordinates


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: [help][gdalwarp]Use of gdalwarp with data overlapping antimeridian

Robert Coup
Hi Christophe,

Have a look at the following:


I'd suggest building a couple of VRT files to treat your data as -180 to +180, then project each independently to EPSG:3857.

I'm sure there used to be an example in the GDAL docs, but I can't find it - maybe I'm imagining it :)

As I’m new on this mail list do I have to “Reply All”? or just reply to you?

Reply all is good — that way everyone can read it.

Cheers,

Rob.

On 7 March 2018 at 13:05, LAVOYE Christophe <[hidden email]> wrote:

Hi Robert,

 

You could find my sample in attached files.

 

This is the gdal informations:

 

Driver: GTiff/GeoTIFF

Files: D:\TEMP\TempProjectionsV2\BASE\baseAnteMeridien.tiff

Size is 900, 803

Coordinate System is:

GEOGCS["WGS 84",

    DATUM["WGS_1984",

        SPHEROID["WGS 84",6378137,298.257223563,

            AUTHORITY["EPSG","7030"]],

        AUTHORITY["EPSG","6326"]],

    PRIMEM["Greenwich",0],

    UNIT["degree",0.0174532925199433],

    AUTHORITY["EPSG","4326"]]

GeoTransform =

  179.9362167765823, 0.001541256882521351, 1.892378333877928e-005

  66.12419696670919, 9.991578318404334e-006, -0.0006775726479453831

Metadata:

  AREA_OR_POINT=Area

  TIFFTAG_XRESOLUTION=96

  TIFFTAG_YRESOLUTION=96

Image Structure Metadata:

  COMPRESSION=JPEG

  INTERLEAVE=PIXEL

Corner Coordinates:

Upper Left  ( 179.9362168,  66.1241970) (179d56'10.38"E, 66d 7'27.11"N)

Lower Left  ( 179.9514126,  65.5801061) (179d57' 5.09"E, 65d34'48.38"N)

Upper Right (     181.323,      66.133) (181d19'24.05"E, 66d 7'59.48"N)

Lower Right (     181.339,      65.589) (181d20'18.76"E, 65d35'20.75"N)

Center      ( 180.6373803,  65.8566478) (180d38'14.57"E, 65d51'23.93"N)

Band 1 Block=900x803 Type=Byte, ColorInterp=Red

Band 2 Block=900x803 Type=Byte, ColorInterp=Green

Band 3 Block=900x803 Type=Byte, ColorInterp=Blue

 

So my question concerns data which past +180° a

 

I made old tests where I first cut my image and then make two warp operations and I remember it was working. I didn’t try to re-associate then.

I have to test.

 

As I’m not an expert I want to know the best approach to enable reprojection on those kind of data with coordinate over +180°.

 

As I’m new on this mail list do I have to “Reply All”? or just reply to you?

 

Best regards,

 

 

cid:image003.png@01D1FD34.3B7C8CC0

Christophe LAVOYE - Analyste
AKKA Technologies
Informatique & Systèmes
7 boulevard Henri Ziegler – 31700 BLAGNAC
Tél : <a href="tel:+33%205%2036%2025%2015%2040" value="+33536251540" target="_blank">+33 (0)5 36 25 15 40
Email :
[hidden email]

 

 

De : Robert Coup [mailto:[hidden email]]
Envoyé : mercredi 7 mars 2018 12:33
À : LAVOYE Christophe
Cc : [hidden email]
Objet : Re: [gdal-dev] [help][gdalwarp]Use of gdalwarp with data overlapping antimeridian

 

Hi Christophe,

 

What do you expect or want to happen with your images?

 

Are your 4326 image coordinates in -180° to +180° range (ie. the right longitude is < the left); or do they go past +180°?

 

3857 is a projected coordinate system, so doesn't have a builtin concept of wrapping. Some clients implement. 

Do you want x values >20037508.34? But they'll only display on the "right" side of the world then (if at all).

 

The simplest approach is likely to be to do two warp operations, for the left and right parts, ending up with two images — one with left=-20037508.34 and one with right=+20037508.34

 

Rob :)

 

 

On 1 March 2018 at 15:23, LAVOYE Christophe <[hidden email]> wrote:

Hello,

 

I’m using GDAL library in a C# project.

 

To reproject some geotiff files i’m calling gdalwarp tool as external process with this command:

 

gdalwarp.exe -s_srs EPSG:4326 -t_srs EPSG:3857 -dstalpha input.tiff output.tiff

 

 

All works fine except for data overlapping antimeridian such as the associated tiff file.

 

I don’t find how fix my problem or if I’m using the correct tool for those kind of data.

 

 

Best regards,

 

 

cid:image003.png@01D1FD34.3B7C8CC0

Christophe LAVOYE - Analyste
AKKA Technologies
Informatique & Systèmes
7 boulevard Henri Ziegler – 31700 BLAGNAC
Tél : <a href="tel:+33%205%2036%2025%2015%2040" target="_blank">+33 (0)5 36 25 15 40
Email :
[hidden email]

 

 


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev



 

--

Chief Technology Officer Koordinates

<a href="tel:+44%20759%209873480" target="_blank">+44 759 987 3480 / koordinates.com / @koordinates




--

Chief Technology Officer Koordinates

<a href="tel:+44%20759%209873480" target="_blank">+44 759 987 3480 / koordinates.com / @koordinates


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: [help][gdalwarp]Use of gdalwarp with data overlapping antimeridian

Even Rouault-2

On jeudi 8 mars 2018 14:40:44 CET Robert Coup wrote:

> Hi Christophe,

>

> Have a look at the following:

>

> https://lists.osgeo.org/pipermail/gdal-dev/2016-January/043358.html

> https://gis.stackexchange.com/questions/37790/how-to-

> reproject-raster-from-0-360-to-180-180-with-cutting-180-meridian

>

> I'd suggest building a couple of VRT files to treat your data as -180 to

> +180, then project each independently to EPSG:3857.

>

> I'm sure there used to be an example in the GDAL docs, but I can't find it

> - maybe I'm imagining it :)

 

Probably you remember of Frank's tutorial at

https://trac.osgeo.org/gdal/wiki/UserDocs/RasterProcTutorial

See the "Virtual files" section towards the end.

 

Thinking just out loud: some Python script using gdal.Warp() API to deal with antimeridian could be a useful contribution to the project

 

Like start with a raster in UTM 60 / UTM 1 crossing the antimeridian and produce 2 geotiffs in EPSG:4326 / EPSG:3857 with the east and west parts.

Recent ticket somewhat related :

https://trac.osgeo.org/gdal/ticket/7247

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: [help][gdalwarp]Use of gdalwarp with data overlapping antimeridian

chris Lav
In reply to this post by Robert Coup

Hi Robert,

 

For the context i’m using GDAL 2.1.3 and i download the last stable release 2.2.3 to do my tests.

 

I was able to gdalwarp a .tif overlapping the anti-meridian with

--config CENTER_LONG 180

 

I didn’t succeed to use this command with –config CENTER_LON

 

I have tried:

 

gdalwarp -overwrite -t_srs WGS84 ..\DATA\baseAntiMeridien.tiff ..\DATA\output.tiff --config CENTER_LONG 180 -wo SOURCE_EXTRA=1000

 

gdalwarp -overwrite -s_srs EPSG:4326 -t_srs EPSG:3857 -dstalpha ..\DATA\baseAntiMeridien.tiff ..\DATA\output.tiff --config CENTER_LONG 180

 

etc…

 

 

On the other way I have been able to:

 

1-      Cut my original image with 180 merifian

 

gdalwarp -overwrite -s_srs EPSG:4326 -t_srs EPSG:4326 -te  179.9362168 65.5801061 180 66.133 -dstalpha ..\DATA\ baseAntiMeridien.tiff ..\DATA\output_cut1.tiff

 

gdalwarp -overwrite -s_srs EPSG:4326 -t_srs EPSG:4326 -te  180 65.5801061 181.339 66.133 -dstalpha ..\DATA\ baseAntiMeridien.tiff ..\DATA\output_cut2.tiff

 

 

2-      Reproject the first cut to EPSG:3857

 

gdalwarp -overwrite -s_srs EPSG:4326 -t_srs EPSG:3857 ..\DATA\output_cut1.tiff ..\DATA\output_cut1_proj_3857.tiff

 

3-      Translate the second cut to be inside -180 : 180

 

gdalwarp -overwrite -s_srs “+proj=latlong +datum=WGS84 +pm=180dW” -t_srs EPSG:4326 ..\DATA\output_cut2.tiff ..\DATA\output_cut2_translate.tiff

 

4-      Reproject the secong cut

 

gdalwarp -overwrite -s_srs EPSG:4326 -t_srs EPSG:3857 ..\DATA\output_cut2_translate.tiff ..\DATA\output_cut2_translate_proj_3857.tiff

 

 

Now I’m trying to merge those two image but I didn’t succed.

 

I suppose I have to use gdal_merge.py but I have an error “ImportError: No module named osgeo”. I’m trying to well configure my python.

 

Is this way looks good for you?

 

 

 

 

Best Regards,

 

cid:image003.png@01D1FD34.3B7C8CC0

Christophe LAVOYE - Analyste
AKKA Technologies
Informatique & Systèmes
7 boulevard Henri Ziegler – 31700 BLAGNAC
Tél : +33 (0)5 36 25 15 40
Email :
[hidden email]

 

 

De : Robert Coup [mailto:[hidden email]]
Envoyé : jeudi 8 mars 2018 15:41
À : LAVOYE Christophe
Cc : [hidden email]
Objet : Re: [gdal-dev] [help][gdalwarp]Use of gdalwarp with data overlapping antimeridian

 

Hi Christophe,

 

Have a look at the following:

 

 

I'd suggest building a couple of VRT files to treat your data as -180 to +180, then project each independently to EPSG:3857.

 

I'm sure there used to be an example in the GDAL docs, but I can't find it - maybe I'm imagining it :)

 

As I’m new on this mail list do I have to “Reply All”? or just reply to you?

 

Reply all is good — that way everyone can read it.

 

Cheers,

 

Rob.

 

On 7 March 2018 at 13:05, LAVOYE Christophe <[hidden email]> wrote:

Hi Robert,

 

You could find my sample in attached files.

 

This is the gdal informations:

 

Driver: GTiff/GeoTIFF

Files: D:\TEMP\TempProjectionsV2\BASE\baseAnteMeridien.tiff

Size is 900, 803

Coordinate System is:

GEOGCS["WGS 84",

    DATUM["WGS_1984",

        SPHEROID["WGS 84",6378137,298.257223563,

            AUTHORITY["EPSG","7030"]],

        AUTHORITY["EPSG","6326"]],

    PRIMEM["Greenwich",0],

    UNIT["degree",0.0174532925199433],

    AUTHORITY["EPSG","4326"]]

GeoTransform =

  179.9362167765823, 0.001541256882521351, 1.892378333877928e-005

  66.12419696670919, 9.991578318404334e-006, -0.0006775726479453831

Metadata:

  AREA_OR_POINT=Area

  TIFFTAG_XRESOLUTION=96

  TIFFTAG_YRESOLUTION=96

Image Structure Metadata:

  COMPRESSION=JPEG

  INTERLEAVE=PIXEL

Corner Coordinates:

Upper Left  ( 179.9362168,  66.1241970) (179d56'10.38"E, 66d 7'27.11"N)

Lower Left  ( 179.9514126,  65.5801061) (179d57' 5.09"E, 65d34'48.38"N)

Upper Right (     181.323,      66.133) (181d19'24.05"E, 66d 7'59.48"N)

Lower Right (     181.339,      65.589) (181d20'18.76"E, 65d35'20.75"N)

Center      ( 180.6373803,  65.8566478) (180d38'14.57"E, 65d51'23.93"N)

Band 1 Block=900x803 Type=Byte, ColorInterp=Red

Band 2 Block=900x803 Type=Byte, ColorInterp=Green

Band 3 Block=900x803 Type=Byte, ColorInterp=Blue

 

So my question concerns data which past +180° a

 

I made old tests where I first cut my image and then make two warp operations and I remember it was working. I didn’t try to re-associate then.

I have to test.

 

As I’m not an expert I want to know the best approach to enable reprojection on those kind of data with coordinate over +180°.

 

As I’m new on this mail list do I have to “Reply All”? or just reply to you?

 

Best regards,

 

 

cid:image003.png@01D1FD34.3B7C8CC0

Christophe LAVOYE - Analyste
AKKA Technologies
Informatique & Systèmes
<a href="https://maps.google.com/?q=7&#43;boulevard&#43;Henri&#43;Ziegler&#43;%E2%80%93&#43;31700&#43;BLAGNAC&amp;entry=gmail&amp;source=g">7 boulevard Henri Ziegler – 31700 BLAGNAC
Tél : <a href="tel:&#43;33%205%2036%2025%2015%2040" target="_blank">+33 (0)5 36 25 15 40
Email :
[hidden email]

 

 

De : Robert Coup [mailto:[hidden email]]
Envoyé : mercredi 7 mars 2018 12:33
À : LAVOYE Christophe
Cc : [hidden email]
Objet : Re: [gdal-dev] [help][gdalwarp]Use of gdalwarp with data overlapping antimeridian

 

Hi Christophe,

 

What do you expect or want to happen with your images?

 

Are your 4326 image coordinates in -180° to +180° range (ie. the right longitude is < the left); or do they go past +180°?

 

3857 is a projected coordinate system, so doesn't have a builtin concept of wrapping. Some clients implement. 

Do you want x values >20037508.34? But they'll only display on the "right" side of the world then (if at all).

 

The simplest approach is likely to be to do two warp operations, for the left and right parts, ending up with two images — one with left=-20037508.34 and one with right=+20037508.34

 

Rob :)

 

 

On 1 March 2018 at 15:23, LAVOYE Christophe <[hidden email]> wrote:

Hello,

 

I’m using GDAL library in a C# project.

 

To reproject some geotiff files i’m calling gdalwarp tool as external process with this command:

 

gdalwarp.exe -s_srs EPSG:4326 -t_srs EPSG:3857 -dstalpha input.tiff output.tiff

 

 

All works fine except for data overlapping antimeridian such as the associated tiff file.

 

I don’t find how fix my problem or if I’m using the correct tool for those kind of data.

 

 

Best regards,

 

 

cid:image003.png@01D1FD34.3B7C8CC0

Christophe LAVOYE - Analyste
AKKA Technologies
Informatique & Systèmes
<a href="https://maps.google.com/?q=7&#43;boulevard&#43;Henri&#43;Ziegler&#43;%E2%80%93&#43;31700&#43;BLAGNAC&amp;entry=gmail&amp;source=g">7 boulevard Henri Ziegler – 31700 BLAGNAC
Tél : <a href="tel:&#43;33%205%2036%2025%2015%2040" target="_blank">+33 (0)5 36 25 15 40
Email :
[hidden email]

 

 


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev



 

--

Chief Technology Officer Koordinates

<a href="tel:&#43;44%20759%209873480" target="_blank">+44 759 987 3480 / koordinates.com / @koordinates



 

--

Chief Technology Officer Koordinates

<a href="tel:&#43;44%20759%209873480" target="_blank">+44 759 987 3480 / koordinates.com / @koordinates


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev