1

I am trying to show in leaflet a geotiff raster image that was generated in gvSig. The basemap I am using in leaflet is a wms server with projection EPSG:3857.

Leaflet needs to know the upper right and bottom left corners in latitude and longitude coordinates which I get from the tfw file.

When I add my raster image the south west and north east corners are displayed in the correct position (the ones I specify to leaflet), but the other two are not. And most of the image is not displayed at the correct position either. It seems there is a problem with the projections.

gdalinfo of the raster file shows:

Driver: GTiff/GeoTIFF
Files: ModCombustible.tif
Size is 600, 945
Coordinate System is:
PROJCS["ETRS89 / UTM zone 30N",
    GEOGCS["ETRS89",
        DATUM["European_Terrestrial_Reference_System_1989",
            SPHEROID["GRS 1980",6378137,298.257222101,
                AUTHORITY["EPSG","7019"]],
            TOWGS84[0,0,0,0,0,0,0],
            AUTHORITY["EPSG","6258"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4258"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-3],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["Easting",EAST],
    AXIS["Northing",NORTH],
    AUTHORITY["EPSG","25830"]]
Origin = (713179.879402380902320,4381253.375599999912083)
Pixel Size = (5.001750158730428,-5.001750158730441)

I tried to use gdalwarp to reproject the raster in EPSG:3857 with the command: gdalwarp -t_srs EPSG:3857 ModCombustible.tif ModCombustible_3857.tif

but in the tfw file I am getting negative UTM easting coordinates which doesn't make any sense to me.

What should I do to properly show the raster image in leaflet?

EDIT: The negative easting coordinates are correct for the EPSG:3857 if they are west of London. Using the link provided by the user30184 I could translate the coordinates to latitude and longitude and show the image at the correct position.

EDIT2: To clarify basic concepts which were not clear to me: as IvanSanchez mentioned in the comments, UTM (Universal Transverse Mercator) is a system of 60 different projections using false easting and northing. In the other hand Web Mercator (EPSG:3857) is not UTM but uses easting and northing coordinates to define a position. It is the de facto standard for web map applications.

  • 1
    If you are west to London then EPSG:3857 eastings are negative epsg.io/… – user30184 Feb 9 '17 at 15:24
  • Thank you! I did not realize that EPSG:3857 can be negative. In the link you provided I could transform to lat long and load the raster in leaflet at the correct position :) – Guillermo Feb 10 '17 at 19:02
1

Just to be sure, use the -s_srs option of gdalwarp to force a source SRS for the warping, e.g.:

gdalwarp -s_srs EPSG:25830 -t_srs EPSG:3857 ModCombustible.tif ModCombustible_3857.tif
  • Thank you. I added the source SRS but I keep getting negative utm coordinates Upper Left ( -57917.696, 4801412.920) ( 0d31'13.02"W, 39d33'16.20"N) Lower Left ( -57917.696, 4795165.270) ( 0d31'13.02"W, 39d30'40.37"N) Upper Right ( -53865.167, 4801412.920) ( 0d29' 1.96"W, 39d33'16.20"N) Lower Right ( -53865.167, 4795165.270) ( 0d29' 1.96"W, 39d30'40.37"N) Center ( -55891.431, 4798289.095) ( 0d30' 7.49"W, 39d31'58.29"N) – Guillermo Feb 10 '17 at 18:42
  • Don't call the UTM coordinates, they are EPSG:3857 (Web Mercator) coordinates, and propably just right. – user30184 Feb 10 '17 at 19:39
  • I am a bit confused with the vocabulary, I thought that UTM was an umbrella term for any Easting Northing projection. But I guess it is a map projection itself and each UTM zone has its own EPSG code. Is that correct? In that case I will edit the question to clarify it. – Guillermo Feb 13 '17 at 10:37
  • No, UTM stands for Universal Transverse Mercator. It has a false easting and false northing, but other projections (such as polar stereographic) also do. UTM is not a projection; UTM is a system of 60 different but obviously similar projections and CRSs. – IvanSanchez Feb 13 '17 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.