This project has moved. For the latest updates, please go here.

Load georeferenced tif

Aug 5, 2016 at 7:06 AM
Edited Aug 5, 2016 at 7:23 AM
Hello guys!

I have some geotiff files on my local PC. How can I load them in to MapControl? Maybe there is some function in the MapControl witch can read georeference from GeoTIFF file?

Thanks in advice!
Coordinator
Aug 8, 2016 at 5:53 PM
There is no such function. You may however use a MapImage and assign the TIFF to its Source property. Then you would also set its West, East, South and North properties.
Mar 9 at 12:26 PM
Hi,

Is there a way to load images on the fly? Tried various versions of binding and changing MapImage Source in map's children but nothing seems to work. MapImage works fine when defined in a static way in XAML - official example:
<map:MapImage x:Name="mapImage" South="53.54031" North="53.74871" West="8.08594" East="8.43750"
                          Source="10_535_330.jpg" Opacity="0.5"/>
but can't find a way to load another image on the fly. Is this thing possible? Something like this:
<map:MapImage x:Name="mapImage" DataContext="{Binding MapImage}" South="{Binding South}" North="{Binding North}" 
                          West="{Binding West}" East="{Binding East}"
                          Source="{Binding Source}" Opacity="0.75"/>
Thanks!
Coordinator
Mar 9 at 8:35 PM
Edited Mar 9 at 8:35 PM
That should work, provided that the Bindings work correctly. However, DataContext="{Binding MapImage}" doesn't seem to make sense.
Mar 21 at 11:59 AM
Alright, different problem this time. I am struggling with the coordinates mapping. I have a GeoTiff and coordinates extracted from it by GDAL. Can anybody confirm (could not find any hard evidence in the code) the mapping between map image corners and the properties used by XAML MapImage? Which corners do I map to North, East, South and West properties of the MapImage? Initially I though UpperRight for NE and LowerLeft for SW based on the example provided in the project, but it does not seem correct - please help to understand!

Here is the example spatial data (I convert degrees, minutes and seconds to decimal degrees):
Coordinate System is:
PROJCS["WGS_1984_UTM_Zone_33N",
    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["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",15],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","32633"]]
Origin = (515000.000000000000000,6495000.000000000000000)
Pixel Size = (1.000000000000000,-1.000000000000000)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
  TIFFTAG_SOFTWARE=Handmade Software, Inc. Image Alchemy v1.11
  TIFFTAG_XRESOLUTION=300
  TIFFTAG_YRESOLUTION=300
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  515000.000, 6495000.000) ( 15d15'29.03"E, 58d35'42.48"N)
Lower Left  (  515000.000, 6490000.000) ( 15d15'27.84"E, 58d33' 0.81"N)
Upper Right (  520000.000, 6495000.000) ( 15d20'38.70"E, 58d35'41.75"N)
Lower Right (  520000.000, 6490000.000) ( 15d20'37.11"E, 58d33' 0.09"N)
Center      (  517500.000, 6492500.000) ( 15d18' 3.17"E, 58d34'21.31"N)
Coordinator
Mar 22 at 6:53 PM
Edited Mar 22 at 6:54 PM
Not sure what exactly could be unclear with the terms west, east, south and north.

MapImage fills a rectangular area with the
  • left edge at the West longitude,
  • right edge at the East longitude (hence West < East),
  • bottom edge at the South latitude and
  • top edge at the North latitude (hence South < North)
The edges of your image aren't parallel in the WebMercator projection, so you'll have to find an approximation, e.g. mean values.
Mar 22 at 7:35 PM
Ah... shame to admit, but I mixed longitude with latitude... that's why images were shown in strange places and with strange shapes...

Thanks for the reply!