ClemensFischer / XAML-Map-Control

XAML Map Control Library
Microsoft Public License
205 stars 61 forks source link

[usage/general] Any suggestions on how to use GeoTIFFs? #45

Closed bergziege closed 4 years ago

bergziege commented 4 years ago

Hi, are there any experiences/suggestions out there on how to use GeoTIFF images (like from https://www.faa.gov/air_traffic/flight_info/aeronav/digital_products/vfr/) with the map control?

I have a small app for flight simulation (https://github.com/bergziege/XPlaneLauncher) where it would be nice to show some geotiff files (sector charts) on the map to give the user better route planing ability.

ClemensFischer commented 4 years ago

It would work out of the box like e.g.

xmlns:img="clr-namespace:MapControl.Images;assembly=MapImages.WPF"
...
<Image img:WorldFileImage.Path="Los_Angeles_106\Los Angeles SEC 106.tif"/>

provided that the world file (the .tfw) file would use WGS 84 as coordinate reference system.

You may perhaps convert those values, or try to provide an additional .prj file with the WKT of the current projection, like

PROJCS["Lambert Conformal Conic",
    GEOGCS["GCS_North_American_1983",
        DATUM["North_American_Datum_1983",
            SPHEROID["GRS_1980",6378137,298.257222101]],
        PRIMEM["Greenwich",0],
        UNIT["Degree",0.017453292519943295]],
    PROJECTION["Lambert_Conformal_Conic_2SP"],
    PARAMETER["Standard_Parallel_1",38.66666666666666],
    PARAMETER["Standard_Parallel_2",33.33333333333334],
    PARAMETER["Central_Meridian",-118.4666666666667],
    PARAMETER["Latitude_Of_Origin",34.16666666666666],
    PARAMETER["False_Easting",0],
    PARAMETER["False_Northing",0],
    UNIT["Meter",1]]

For details, please take a look at https://github.com/ClemensFischer/XAML-Map-Control/blob/master/MapImages/Shared/WorldFileImage.cs

However, be aware that the map image also uses a Lambert Conformal Conic projection. Since XAML Map Control does not support reprojecting, layering it over the standard OpenStreetMap Web Mercator projection won't result in a good fit. You may then perhaps also use the projection in the Map control (by means of the GeoApiProjection class in the MapProjections library), but you wouldn't be able to use OpenStreetMap data with that projection. Maybe you can use a Web Map Service that supports it.