フィルターのクリア

Is High Resolution Satellite Imagery in GeoGlobe Possible Offline? ...and in a Compiler SDK .NET DLL?

11 ビュー (過去 30 日間)
We currently have a matlab product we use offline and compile to a DLL for calling from a C# program. I'm looking into the mapping toolbox to see if we could use the geoglobe plots. However, there is a big issue of the map imagery needing internet access. I've been digging though this link.
The closest thing I've seen so far is saving off of the Tiff files, but the example show is VERY low resolution and the documentation does not even suggest it supports geoglobe. Meanwhile, the downloadable options (like "colorterrain") all provide very little detail when close in.
I realize this would potentially be massive in size. I'm OK with that. Also, I would likely just be targeting specific regions for the high resolution imagery.
Note also I don't need this solution to be within Matlab. Could I potentially download and replicate the image server on the local network and simply point matlab to that local URL using addCustomBaseMap?

回答 (1 件)

Kojiro Saito
Kojiro Saito 2024 年 4 月 3 日
geoglobe accepts custom basemap but addCustomBasemap only allows URL or MBTiles file, so you need to host internal Web Map Server or provide .mbtiles file in local.
First, you need to create GeoTIFF file from readBasemapImage and geotiffwrite with serveral zoom levels.
For example around Boston area,
mapCenter = [42.3453 -71.099];
for zoomLevel=0:19
[A1,R1,attrib1] = readBasemapImage("satellite", mapCenter, zoomLevel);
tag = struct("ImageDescription",attrib1);
geotiffwrite(strcat("satelliteBoston_", num2str(zoomLevel), ".tif"), A1,R1,CoordRefSysCode=3857,TiffTags=tag)
end
Next you need to create.mbtiles file from GeoTIFF raster imagery and GDAL is needed. There are several versions of GDAL, and OSGeo4W provides binaries for Windows from ​OSGeo4W network installer link. gdal_translate commands create .mbtiles from GeoTIFF.
Currently, gdal_translate cannot create one .mbtiles from multiple raster imagery, so we need to create multiple .mbtiles with several zoom levels. Be sure to add GDAL_INSTALL\OSGeo4W\bin to your PATH environment.
gdalTransCmd = @(x) sprintf("gdal_translate satelliteBoston_%d.tif satelliteBoston_tiles_%d.mbtiles -of MBTILES", x, x);
for n=0:19
system(gdalTransCmd(n));
end
Then, you need to merge several .mbtiles to one .mbtiles file. MBTiles is based on SQLite, so we can use sqlite3.exe located in GDAL_INSTALL\OSGeo4W\bin.
copyfile("satelliteBoston_tiles_0.mbtiles", "satelliteBoston_tiles_merge.mbtiles")
sqliteCmd = "sqlite3 satelliteBoston_tiles_merge.mbtiles";
% SQLite allows 10 attached databases, so split 19 times to 1-10 and 11-19
for n=1:10
if n==1
sqliteCmd = strcat(sqliteCmd, ' "');
end
sqliteCmd = strcat(sqliteCmd, sprintf("ATTACH 'satelliteBoston_tiles_%d.mbtiles' as db%d;", n, n));
sqliteCmd = strcat(sqliteCmd, sprintf("INSERT INTO tiles select * from db%d.tiles;", n));
if n==10
sqliteCmd = strcat(sqliteCmd, '"');
end
end
system(sqliteCmd)
sqliteCmd = "sqlite3 satelliteBoston_tiles_merge.mbtiles";
for n=11:19
if n==11
sqliteCmd = strcat(sqliteCmd, ' "');
end
sqliteCmd = strcat(sqliteCmd, sprintf("ATTACH 'satelliteBoston_tiles_%d.mbtiles' as db%d;", n, n));
sqliteCmd = strcat(sqliteCmd, sprintf("INSERT INTO tiles select * from db%d.tiles;", n));
if n==19
sqliteCmd = strcat(sqliteCmd, '"');
end
end
system(sqliteCmd);
Now you have one satelliteBoston_tiles_merge.mbtiles file which includes zoom level 0 to 19.
Next, you can add a basemap from MBTiles.
.mbtiles file and the following addCustomBasemap code is neede in compiled .m file.
mbtilesFilename = "satelliteBoston_tiles_merge.mbtiles";
basemap = "satellite_offline_tiles_merge";
addCustomBasemap(basemap, mbtilesFilename, Attribution="Some Attribution", MaxZoomLevel=19, IsDeployable=true)
After that you can use geoglobe offline.
gg = geoglobe(uifigure, "Basemap", basemap);
geoglobe uses terrain data gmted2010 which needs internet access. So, if you want to use terrain data, you need to provide DTED files. For detail, please see this document
Access Terrain
By default, the geographic globe uses terrain data hosted by MathWorks and derived from the GMTED2010 model by the USGS and NGA. You need an active internet connection to access this terrain data, and you cannot download it.
To work offline or to improve terrain responsiveness, add custom terrain from DTED files using the addCustomTerrain function. You do not need an active internet connection to add or use custom terrain.
Alternatively, you can set the Terrain property of the geographic globe object to 'none'.
I hope this helps.

カテゴリ

Help Center および File ExchangeMATLAB Compiler SDK についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by