display data on openstreetmap basemap -凯发k8网页登录
this example shows how to display a driving route and vehicle positions on an openstreetmap® basemap.
add the openstreetmap basemap to the list of basemaps available for use with the geoplayer
object. after you add the basemap, you do not need to add it again in future sessions.
name = 'openstreetmap'; url = 'https://a.tile.openstreetmap.org/${z}/${x}/${y}.png'; 凯发官网入口首页 copyright = char(uint8(169)); attribution = 凯发官网入口首页 copyright "openstreetmap contributors"; addcustombasemap(name,url,'attribution',attribution)
load a sequence of latitude and longitude coordinates.
data = load('georoute.mat');
create a geographic player. center the geographic player on the first position of the driving route and set the zoom level to 12.
zoomlevel = 12; player = geoplayer(data.latitude(1),data.longitude(1),zoomlevel);
display the full route.
plotroute(player,data.latitude,data.longitude);
by default, the geographic player uses the world street map basemap ('streets'
) provided by esri®. update the geographic player to use the added openstreetmap basemap instead.
player.basemap = 'openstreetmap';
display the route again.
plotroute(player,data.latitude,data.longitude);
display the positions of the vehicle in a sequence.
for i = 1:length(data.latitude) plotposition(player,data.latitude(i),data.longitude(i)) end
see also
| | | |