This project has moved and is read-only. For the latest updates, please go here.

Load georeferenced tif

Aug 5, 2016 at 8:06 AM
Edited Aug 5, 2016 at 8: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!
Aug 8, 2016 at 6: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, 2017 at 1:26 PM

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"/>
Mar 9, 2017 at 9:35 PM
Edited Mar 9, 2017 at 9:35 PM
That should work, provided that the Bindings work correctly. However, DataContext="{Binding MapImage}" doesn't seem to make sense.
Mar 21, 2017 at 12:59 PM
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:
    GEOGCS["WGS 84",
            SPHEROID["WGS 84",6378137,298.257223563,
Origin = (515000.000000000000000,6495000.000000000000000)
Pixel Size = (1.000000000000000,-1.000000000000000)
  TIFFTAG_SOFTWARE=Handmade Software, Inc. Image Alchemy v1.11
Image Structure Metadata:
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)
Mar 22, 2017 at 7:53 PM
Edited Mar 22, 2017 at 7: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, 2017 at 8: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!