AddCustombaseMap
添加自定义基础图
句法
Description
AddCustombaseMap(
添加由basemapname
,,,,URL
)URL
到可用于映射函数的基础图列表。basemapname
is the name you choose to call the custom basemap. Added basemaps remain available for use in future MATLAB®sessions.
You can use custom basemaps with several types of map displays, for example, web maps created using the网络图
function, geographic globes created using the地理风险
功能,以及使用该轴创建的地理轴地理
功能。
AddCustombaseMap(
添加由basemapname
,,,,MBTILESFILENAME
)MBTILESFILENAME
,,,,一个n MBTiles file containing a tile set of raster data. You can use the basemap in future MATLAB sessions, provided the MBTiles file is still on the same path as when you add it.
Web地图不支持MBTILES文金宝app件创建的自定义基础图。
Examples
Add Basemap from OpenStreetMap
使用OpenStreetMap®的基础图在地理气泡图上显示位置。
Define the name that you will use to specify your custom basemap.
name =“ OpenStreetMap”;
指定提供地图数据的网站。URL的第一个字符表示要使用哪个服务器来获取数据。对于负载平衡,提供商可以使用三个服务器:a,b或c。
url ='a.tile.opentreetmap.org';
创建一个要在地图上显示的归因,以信用地图数据的提供商。网络地图提供商可能会定义归因的特定要求。
版权= char(uint8(169));归因=版权 +"OpenStreetMap contributors";
Add the custom basemap to the list of basemap layers available.
AddCustombaseMap(名称,URL,'归因',归因)
Plot the locations over the map using a geographic bubble chart. You can specify your custom basemap when you create the geographic bubble chart.
lat = [42.3501 42.3515 42.3598 42.3584 42.3529]; lon = [-71.0870 -71.0926 -71.0662 -71.0598 -71.0662]; gb = geobubble(lat,lon,'basemap',,,,“ OpenStreetMap”);gb.bubblewidthrange = 25;gb.maplayout ='maximized';GB.Zoomlevel = 14;
Add Basemap from USGS National Map
使用USGS国家地图中的地形基础图在2-D和3-D中显示滑翔机的路线。
在添加基础图之前,请指定地图图块的位置。为此,请指定国家地图ArcGIS REST服务目录的URL。然后,从USGS TOPO BASEMAP服务中添加路径。
url ="https://basemap.nationalmap.gov/ArcGIS/rest/services";fullurl = url +"/USGSTopo/MapServer/tile/${z}/${y}/${x}";
指定基础图和归因文本的名称。
nm ='usgstopo';一个tt ='Credit: US Geological Survey';
最后,添加USGS TOPO BASEMAP。
AddCustombaseMap(nm,fullurl,'归因',att)
将滑翔机的路径绘制在基础上。为此,请物质纬度,经度和地质高度值。
trk = gpxRead('sample_mixed',,,,'FeatureType',,,,'追踪');lat = trk.latitude;lon = trk。h = trk.elevation;
Display the path in 2-D using geographic axes. Specify the basemap using thegeobasemap
函数和基础图的名称。使用创建时给出的基础图名称。称呼坚持,稍等
在绘制线路之前,以防止基础图重置。
地理局部((lat,lon) geobasemap('usgstopo') 抓住上Geoplot(LAT,LON,'r')
Display the path in 3-D using a geographic globe. Specify the basemap using the'basemap'
名称值对参数。默认情况下,视图直接在路径上方。通过保持倾斜Ctrl一个nd dragging.
uif = uifigure;g = geoglobe(uif,'basemap',,,,'usgstopo');保持(g,'上')geoplot3(g,lat,lon,h,'r')
添加OpenTopomap的基础图
使用OpentOpomap的基础图在网络地图上显示滑翔机的路线。
Define the name that you will use to specify your custom basemap.
name =“ opentopomap”;
指定提供地图数据的网站。URL的第一个字符表示要使用哪个服务器来获取数据。对于负载平衡,提供商可以使用三个服务器:一个
,,,,b
, 或者C
。
url =“ a.tile.opentopomap.org”;
创建一个要在地图上显示的归因,以信用地图数据的提供商。网络地图提供商可能会定义归因的特定要求。
版权= char(uint8(169));归因=[..."map data: "+版权 +“ OpenStreetMap贡献者,SRTM”,,,,..."map style: "+版权 +“ opentopomap(cc-by-sa)”];
定义将在图层管理器中出现的名称表示您的自定义基础图。
displayName =“开放Topo Map";
将自定义基础图添加到可用的基础图层列表中。
AddCustombaseMap(名称,URL,“归因”,归因,...“显示名称”,显示名称)
Open a web map. Specify the custom basemap using the name you defined when you added it. Then, read glider data into the workspace and plot it over the basemap.
网络图opentopomaptrk =读取(“ sample_mixed.gpx”,,,,“层”,,,,“轨道”);wmline(trk,“行宽”,,,,2)
添加USGS国家地图的几个基础
Plot the path of a glider over a variety of maps that are available from the USGS National Map site. Viewing data over several maps can help you determine which map provides the best background.
在滑翔机路径轨道数据中阅读。
GT = readgeotable(“ sample_mixed.gpx”,,,,“层”,,,,“轨道”);
指定自定义基础图网址。USGS国家地图支持几个平铺地图。金宝app对于此示例,插入单词基础
进入URL字符串。这样,您可以替换单词基础
带有USGS国家地图支持的一张地图的名称。金宝app
baseurl ="https://basemap.nationalmap.gov/ArcGIS/rest/services";usgsurl = baseurl +"/BASEMAP/MapServer/tile/${z}/${y}/${x}";
指定您要使用的USGS基础群落名称的列表。这些名称将插入URL代替基础
。
basemaps = [“ usgsimageryly”“ usgsimagerytopo”“ USGSTOPO”“ Usgshydrocached”];
指定您可以在每个地图上使用的显示名称列表。使用与所使用的名称相同的显示名称网络图
以便网络图
不包含重复的地图。
displayNames = [“ USGS图像”“ USGS地形图像”...“ USGS阴影地形图”“ USGS水文学”];maxzoomlevel = 16;
Create a map attribution to give credit to the provider of the map data.
归因=“信用:美国地质调查局”;
创建一个循环,其中您将每个基础图与地理局部
功能,绘制每个USGS基底胶的滑翔机数据。
为了k =1:length(basemaps) basemap = basemaps(k); name = lower(basemap); url = replace(usgsURL,"BASEMAP",basemap);displayName = displayNames(k);AddCustombaseMap(名称,URL,“归因”,归因,...“显示名称”,显示名称,"MaxZoomLevel",maxzoomlevel)图Geoplot(GT,“ R”,,,,“行宽”,5);GeoBasemap(baseMap)标题(displayName)结尾
添加MBTILES文件中的basemap
Create a basemap from an MBTiles file containing USGS Imagery.
Add the USGS Imagery basemap to the list of basemaps available for use. TheAddCustombaseMap
函数使用文件中包含的归因和最大缩放级别。
basemap ="usgsimagery";MBTILESFILENAME =“ usgsimagery.mbtiles”;AddCustombaseMap(BaseMap,MBTilesFileName)
将全球土地区域读入工作区,作为地理空间桌。创建一个仅包含澳大利亚的款项。
GT = readgeotable(“ landareas.shp”);澳大利亚= gt(gt.name ====“澳大利亚”,,,,:);
在地理轴上显示澳大利亚的轮廓。更新基础图以使用USGS图像basemap。
figure geoplot(australia,“行宽”,,,,2,“ faceColor”,,,,“没有任何”) 抓住上geobasemap("usgsimagery")
输入参数
basemapname
-用于编程识别基础知识的名称
字符串标量|Character vector
用于以编程方式识别基准的名称,指定为字符串标量或字符向量。
Example:“ OpenStreetMap”
Data Types:细绳
|Char
URL
-参数化地图URL
字符串标量|Character vector
参数化的映射URL,指定为字符串标量或字符向量。参数化的URL是地图图块的索引,格式为$ {z}/$ {x}/$ {y} .png
或者{z}/{x}/{y} .png
,,,,where:
$ {z}
或者{z}
is the tile zoom level.$ {x}
或者{X}
是图块列索引。$ {y}
或者{y}
is the tile row index.
Example:'https:// hostName/$ {z}/$ {x}/$ {y} .png'
Data Types:细绳
|Char
MBTILESFILENAME
-MBTILES文件的名称
Character vector|字符串标量
MBTILES文件的名称,该文件包含一组栅格数据集,该数据集指定为字符向量或字符串标量。您必须包括扩展名.mbtiles
。形式MBTILESFILENAME
取决于文件的位置。
If the file is in your current folder or in a folder on the MATLAB path, then specify the name of the file, such as
“ myfile.mbtiles”
。如果文件不在当前文件夹中或MATLAB路径上的文件夹中,则指定完整或相对路径名,例如
"C:/myfolder/myFile.mbtiles"
或者“ datadir/myfile.mbtiles”
。
Data Types:Char
|细绳
名称值参数
将可选的参数对name1 = value1,...,namen = valuen
,,,,where姓名
是参数名称和价值
is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.
在R2021a之前,请使用逗号分隔每个名称和值,并附上姓名
in quotes.
Example:addCustombaseMap(basemapname,url,“属性”,归因)
归因
-自定义基地的归因
字符串标量|字符串数组|Character vector|细胞一个rray of character vectors
自定义基础图的归因,被指定为字符串标量,字符串数组,字符向量或字符向量的单元格数组。要创建多行归因,请指定字符阵列或非字符矢量的非刻度单元格数组。
当您从URL创建自定义基础图时,默认属性为'Tiles courtesy of
,,,,wheredomain_name_of_url
'
is the domain name from thedomain_name_of_url
URL
input argument. If the host is'localhost'
, 或者ifURL
C上tains only IP numbers, specify the attribution as an empty string (“”
)。
当您从MBTILES文件创建具有属性的MBTILES文件时,AddCustombaseMap
函数从文件中获取归因。如果文件不包含属性,则默认归因是一个空字符串。
Example:“信用:美国地质调查局”
Data Types:细绳
|Char
|细胞
DisplayName
-显示名称的自定义基础图
字符串标量|Character vector
显示自定义基础图的名称,指定为字符串标量或字符向量。
这网络图
函数在图层管理器中使用此名称。这AddToolBarmapButton
function uses this name in the basemap picker.
Example:“ OpenStreetMap”
Data Types:细绳
|Char
maxzoomlevel
-Maximum zoom level of basemap
18
(默认)|integer in range [0, 25]
基础图的最大缩放水平,在[0,25]范围内指定为整数。
When you create a custom basemap from an MBTiles file with the maximum zoom level in the metadata, theAddCustombaseMap
gets the maximum zoom level from the file.
Data Types:单身的
|double
|int8
|int16
|int32
|int64
|UINT8
|uint16
|UINT32
|Uint64
可驱动
-Map is deployable usingMATLAB编译器™
错误的
或者0
(默认)|真的
或者1
Map is deployable usingMATLAB Compiler,,,,specified as a numeric or logical0
((错误的
) 或者1
((真的
)。
要部署使用自定义基础图的地图应用程序,请设置可驱动
至真的
。如果您从MBTILES文件中创建自定义basemap,则必须在已部署的应用程序软件包中包含文件,除非将应用程序部署到用于编译应用程序的同一计算机,或者如果文件在网络文件系统上,则应用程序可以从其他计算机访问。您必须设置此参数是否使用AddCustombaseMap
在您的应用程序或应用程序之外的功能。
Data Types:逻辑
限制
这AddCustombaseMap
函数不支持添加矢量映射图块的自定义基金宝app础图。
Tips
您可以从各个供应商那里找到瓷砖网络地图,例如OpenStreetMap®,USGS国家地图,Mapbox,DigitalGlobe,ESRI®ArcGIS Online,日本地理空间信息局(GSI)和这里的技术。遵守地图供应商的服务条款协议,并与您使用的地图一起包含准确的归因。
要访问可用基础列表的列表,请按Tabbefore specifying the basemap in your plotting function. This image shows a sample list of available basemaps, including several custom basemaps from the USGS National Map.
版本历史记录
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
您单击了与此MATLAB命令相对应的链接:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
您还可以从以下列表中选择一个网站:
如何获得最佳网站性能
选择中国网站(中文或英语)以获得最佳场地性能。其他Mathworks乡村网站未针对您所在的访问进行优化。
美洲
- América Latina(Español)
- 加拿大((英语)
- 美国((英语)