melowntech / workshop

Workshop of Melown 3D stack
10 stars 3 forks source link

How to use TIFF data not projected as WGS84? #14

Closed fnicollet closed 6 years ago

fnicollet commented 6 years ago

Hello,

I tried another TIFF DEM, but this one is not projected in EPSG 3857, but in the standard france projection (EPSG:2154). Is it something that can be done with melown? I imported it and tiled it with "generatevrtwo", but when I use

mapproxy-calipers chartreuse-dem/dem --referenceFrame melown2015

I get the following result

2017-07-26 11:55:26 I3 [2418(main)]: [mapproxy-calipers] Config:
        dataset = "/var/vts/mapproxy/datasets/chartreuse-dem/dem"
        referenceFrame = melown2015
 {main.cpp:configure():158}
gsd: 18.5028
range<pseudomerc>: 11,15 15/8389,8221:8401,8236
range: 11,15 524,513:525,514
position: obj,4.478961,-0.815633,float,0.000000,0.000000,-90.000000,0.000000,37036.611728,55.000000

The coordinates are WGS84 and the tile range are for "worldwide" XYZ tiles. I noticed that because I gave my google maps overlay the same tile range and it would not overlay (downloaded tile images were black because completly out of bounds)

Is it possible to use surface data not projected as WGS84/EPSG:3857 with melown? I would then need to overlay a WMTS/TMS service in local projection (2154) as well, if that's something possible

Thanks,

ladislavhorky commented 6 years ago

VTS can work with input files in any projection. The mapproxy will transform everything on the fly into given reference frame. However, as most of VTS functionality around georeferencing is based on GDAL and PROJ 4, the transformation issues in GDAL/PROJ 4 are present also in VTS which may be - according to a little bit of search - this case. I suggest to start by verifying that the EPSG:2154 projection behaves well in GDAL.

Can you please paste here the output of gdalinfo run on the original DEM for just a rough sanity check?

Regarding the WMTS there are many options:

fnicollet commented 6 years ago

Good call on gdalinfo, it gives me:

vts@BG-test-soft-3D-FN:~/mapproxy/datasets/chartreuse-dem$ gdalinfo MNT_PNRC_L93.tif
Driver: GTiff/GeoTIFF
Files: MNT_PNRC_L93.tif
       MNT_PNRC_L93.tif.aux.xml
Size is 1576, 1972
Coordinate System is:
PROJCS["unnamed",
    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"]],
    PROJECTION["Lambert_Conformal_Conic_2SP"],
    PARAMETER["standard_parallel_1",44],
    PARAMETER["standard_parallel_2",48.99999999999877],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",3.000000000009746],
    PARAMETER["false_easting",700000],
    PARAMETER["false_northing",6600000],
    UNIT["unknown",1]]
Origin = (902666.590348023804836,6505488.327819286845624)
Pixel Size = (25.000000000000000,-25.000000000000000)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_DOCUMENTNAME=ER Mapper 7.0
  TIFFTAG_IMAGEDESCRIPTION=ER Mapper GeoTiff raster translator V1.0: Band 1 = Greyscale
  TIFFTAG_SOFTWARE=ER Mapper 7.0
  TIFFTAG_XRESOLUTION=0
  TIFFTAG_YRESOLUTION=0
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  902666.590, 6505488.328) (  4d21' 1.72"E,  0d38'53.68"S)
Lower Left  (  902666.590, 6456188.328) (  4d20'41.58"E,  0d58'41.47"S)
Upper Right (  942066.590, 6505488.328) (  4d36'46.63"E,  0d39'11.53"S)
Lower Right (  942066.590, 6456188.328) (  4d36'22.58"E,  0d58'59.17"S)
Center      (  922366.590, 6480838.328) (  4d28'43.12"E,  0d48'56.70"S)
Band 1 Block=1576x20 Type=Byte, ColorInterp=Gray
  Min=0.000 Max=253.000
  Minimum=0.000, Maximum=253.000, Mean=54.756, StdDev=49.678
  Metadata:
    STATISTICS_MAXIMUM=253
    STATISTICS_MEAN=54.755589524689
    STATISTICS_MINIMUM=0
    STATISTICS_STDDEV=49.677661201015

Which is not really what I expected (http://epsg.io/2154). It kind of looks like 2154 (it is in Lambert Conformal Conic projection), but somethings are off, it shows as "unnamed" and "latitude_of_origin" is weirdly 0...

fnicollet commented 6 years ago

Ok, I tried forcing it to use 2154 via

gdal_translate MNT_PNRC_L93.tif MNT_PNRC_L93_projected.tif -a_srs EPSG:2154

and gdal_info now gives the right result. I'll try retiling it now and let you know

fnicollet commented 6 years ago
mapproxy-calipers chartreuse-dem/dem --referenceFrame melown2015

now gives the proper result, the "position" is now correct, right in the middle of this national park


vts@BG-test-soft-3D-FN:~/mapproxy/datasets$ mapproxy-calipers chartreuse-dem/dem --referenceFrame melown2015
2017-07-26 15:19:16 I3 [2918(main)]: [mapproxy-calipers] Config:
        dataset = "/var/vts/mapproxy/datasets/chartreuse-dem/dem"
        referenceFrame = melown2015
 {main.cpp:configure():158}
gsd: 25.0189
range<pseudomerc>: 10,14 14/4222,2926:4234,2941
range: 10,14 263,182:264,183
position: obj,5.843478,45.390732,float,0.000000,0.000000,-90.000000,0.000000,50770.431520,55.000000
fnicollet commented 6 years ago

I couldn't properly update only the tileRange/lodRange in resources.json without hitting the cache (http://10.1.21.210:8070/mapproxy/melown2015/tms/chartreuse/gmaps-hybrid-chartreuse/boundlayer.json would always return the old values). I tried some of the commands to bump the version but I must have done it wrong. So instead, I changed the resource id in resource.json and changed my map-config and got it to work!

image

Now I have to try two more things:

Thanks again for your help :)

fnicollet commented 6 years ago

Closing as answered by @ladislavhorky , the remaining issues are on my side