GM_ExportWebFormat issue
I have old C# code based on GlobalMapper v 1.37. Now I am trying to migrate to newest GlobalMapper version (v16)
And I have a problem with "GM_ExportWebFormat" method: it throws exception:
"ExportError: Unexpected error calling GM_ExportWebFormat"
Here is structure of my code
I get exception when call
P.S. GM_ExportWebFormat works fine for "VirtualEarth", "WorldWind", "BingMaps" and "KML". And does not work for "GoogleMaps", "GoogleMaps2", "TMS", "OSM"
And I have a problem with "GM_ExportWebFormat" method: it throws exception:
"ExportError: Unexpected error calling GM_ExportWebFormat"
Here is structure of my code
static class GlobalMapperDll { const string DllName = "GlobalMapperInterface.dll"; .... [DllImport(DllName, EntryPoint = "GM_ExportWebFormat")] public static extern Error ExportWebFormat ( string filename, WebExportFormat webFormat, IntPtr layerList, uint layerCount, IntPtr worldBounds, ref WebFormatExportOptions exportOpts, IntPtr reserved ); .... }
enum WebExportFormat : uint { GoogleMaps, // Google Maps format VirtualEarth, // Virtual Earth (Bing Maps) format KMLRaster, // KML/KMZ raster format WorldWind, // WorldWind tile format TMS, // TMS (Tile Map Service) tile format OSM, // OSM (OpenStreetMap) tile format NumWebFormats }
[StructLayout(LayoutKind.Sequential, Pack = 8)] struct WebFormatExportOptions { public string MapName; // Maximum zoom level to export at (Google Maps, Virtual Earth/Bing Maps, and WorldWind exports only). // Use zero for default value based on resolution of most detailed layer involved in export. public int MaxZoomLevel; // Number of zoom levels to export (Google Maps, Virtual Earth/Bing Maps, and WorldWind exports only) public int NumZoomLevels; // Image format public RasterExportFormat Format; // Export flags public WebExportFlags Flags; // API key (used for Google Maps export) public string ApiKey; // Background map name (used for Google Maps export, ie. G_NORMAL_MAP, G_SATELLITE_MAP, etc.) public string BackgroundMapName; // Translucency setting for new map (0.0 - 1.0). 1.0 is opaque. // If 0.0 is provided, it will be assumed to be 1.0. public double Translucency; // X resolution in arc degrees for export (KML only, default of 0.0 is full resolution) public double XResolution; // Y resolution in arc degrees for export (KML only, default of 0.0 is full resolution) public double YResolution; // path to where WorldWind tiles should be stored. // If null the path to the provide XML file will be used public string WorldWindTilePath; public string CustomTileFileName; // custom definition for tile filenames. Use NULL for default for format. // Use variables like %z for zoom, %x for column, and %y for row. // For example, use "%z\\prefix_%y_%x.png" to do one folder per zoom level. // The tiles are created in the path under the HTML filename path. // Name to use for map set }
I get exception when call
GlobalMapperDll.ExportWebFormat(fileName, format, IntPtr.Zero, 0, IntPtr.Zero, ref options, IntPtr.Zero);Where
format = WebExportFormat.GoogleMaps; options = new WebFormatExportOptions() { MapName = "", MaxZoomLevel = 14, NumZoomLevels = 2, Format = GM_RasterExportFormat_t32.GM_Export_JPG, Flags = 0x00000004, // GM_WebExportFlags_t32.GM_WebExport_HideProgress ApiKey = "ABQIAAAAnfs7bKE82qgb3Zc2YyS-oBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSySz_REpPq-4WZA27OwgbtyR3VcA",//exportParams.ApiKey, BackgroundMapName = HYBRID, Translucency = 0.5 };I attached file that I using to get exception .
P.S. GM_ExportWebFormat works fine for "VirtualEarth", "WorldWind", "BingMaps" and "KML". And does not work for "GoogleMaps", "GoogleMaps2", "TMS", "OSM"
Categories
- 12.7K All Categories
- 5.6K Features Discussion
- 342 Downloading Imagery
- 1.3K Elevation Data
- 380 Georeferencing Imagery Discussion
- 628 GM Script Language
- 53 User Scripts
- 113 GPS Features
- 414 Projection Questions
- 819 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 177 Announcement and News
- 908 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 562 Other Discussion
- 129 GIS Data Sources
- 27 Global Mapper Showcase
- 233 How I use Global Mapper
- 107 Global Mapper Forum Website