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

LAVOYE Christophe Christophe.LAVOYE at akka.eu
Tue Mar 13 02:54:23 PDT 2018


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 at 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 : christophe.lavoye at akka.eu<mailto:christophe.lavoye at akka.eu>



De : Robert Coup [mailto:robert.coup at koordinates.com]
Envoyé : jeudi 8 mars 2018 15:41
À : LAVOYE Christophe
Cc : gdal-dev at lists.osgeo.org
Objet : Re: [gdal-dev] [help][gdalwarp]Use of gdalwarp with data overlapping antimeridian

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 :)

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 <Christophe.LAVOYE at akka.eu<mailto:Christophe.LAVOYE at akka.eu>> 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 at 01D1FD34.3B7C8CC0]

Christophe LAVOYE - Analyste
AKKA Technologies Informatique & Systèmes
7 boulevard Henri Ziegler – 31700 BLAGNAC<https://maps.google.com/?q=7+boulevard+Henri+Ziegler+%E2%80%93+31700+BLAGNAC&entry=gmail&source=g>
Tél : +33 (0)5 36 25 15 40<tel:+33%205%2036%2025%2015%2040>
Email : christophe.lavoye at akka.eu<mailto:christophe.lavoye at akka.eu>



De : Robert Coup [mailto:robert.coup at koordinates.com<mailto:robert.coup at koordinates.com>]
Envoyé : mercredi 7 mars 2018 12:33
À : LAVOYE Christophe
Cc : gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
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 <Christophe.LAVOYE at akka.eu<mailto:Christophe.LAVOYE at akka.eu>> 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 at 01D1FD34.3B7C8CC0]

Christophe LAVOYE - Analyste
AKKA Technologies Informatique & Systèmes
7 boulevard Henri Ziegler – 31700 BLAGNAC<https://maps.google.com/?q=7+boulevard+Henri+Ziegler+%E2%80%93+31700+BLAGNAC&entry=gmail&source=g>
Tél : +33 (0)5 36 25 15 40<tel:+33%205%2036%2025%2015%2040>
Email : christophe.lavoye at akka.eu<mailto:christophe.lavoye at akka.eu>




_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/gdal-dev



--

Chief Technology Officer Koordinates

+44 759 987 3480<tel:+44%20759%209873480> / koordinates.com<http://koordinates.com/> / @koordinates<https://twitter.com/koordinates>



--

Chief Technology Officer Koordinates

+44 759 987 3480<tel:+44%20759%209873480> / koordinates.com<http://koordinates.com/> / @koordinates<https://twitter.com/koordinates>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20180313/47521195/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 11648 bytes
Desc: image001.png
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20180313/47521195/attachment-0001.png>


More information about the gdal-dev mailing list