Main Content

plot

Plot HERE HD Live Map layer data

Description

example

plot(layerData)plots HERE HD Live Map1(HERE HDLM) layer data on a geographic axes.layerDatais a map layer object that was read from the selected tiles of ahereHDLMReaderobject by using thereadfunction.

example

plot(layerData,'Axes',gxIn)plots the layer data in the specified geographic axes,gxIn.

example

gxOut= plot(___)plots the layer data and returns the geographic axes on which the data was plotted, using the inputs from any of the preceding syntaxes. UsegxOutto modify properties of the geographic axes.

Examples

collapse all

Load a sequence of latitude and longitude coordinates from a driving route.

data = load('geoSequence.mat')
data =struct with fields:latitude: [1000×1 double] longitude: [1000×1 double]

Create a HERE HD Live Map (HERE HDLM) reader from the specified coordinates. If you have not previously set up HERE HDLM credentials, a dialog box prompts you to enter them. The reader contains layered map data for the tile that the driving route is on.

reader = hereHDLMReader(data.latitude,data.longitude);

Read road topology data from theTopologyGeometrylayer. Plot the data.

roadTopology = read(reader,'TopologyGeometry'); plot(roadTopology) legend('Location','northeastoutside')

Overlay the driving route coordinates on the plot.

holdongeoplot(data.latitude,data.longitude,'bo-','DisplayName','Route') holdoff

Zoom in on the route.

latcenter = median(data.latitude); loncenter = median(data.longitude); offset = 0.005; latlim = [latcenter-offset,latcenter+offset]; lonlim = [loncenter-offset,loncenter+offset]; geolimits(latlim,lonlim)

Use the HERE HD Live Map (HERE HDLM) service to read the lane topology data of a driving route and its surrounding area. Plot this data, and then stream the route on a geographic player.

Load the latitude and longitude coordinates of a driving route in Natick, Massachusetts, USA.

route = load('geoSequenceNatickMA.mat'); lat = route.latitude; lon = route.longitude;

Stream the coordinates on a geographic player.

player = geoplayer(lat(1),lon(1),'HistoryDepth',5); plotRoute(player,lat,lon)for(lat) plotPosit idx = 1:长度ion(player,lat(idx),lon(idx))end

Create a HERE HDLM reader from the route coordinates. If you have not previously set up HERE HDLM credentials, a dialog box prompts you to enter them. The reader contains map data for the two map tiles that the route crosses.

reader = hereHDLMReader(lat,lon);

Read lane topology data from theLaneTopologylayer of the map tiles. Plot the lane topology.

laneTopology = read(reader,'LaneTopology'); plot(laneTopology)

Overlay the route data on the plot.

holdongeoplot(lat,lon,'bo-','DisplayName','Route'); holdoff

Overlay the lane topology data on the geographic player. Stream the route again.

plot(laneTopology,'Axes',player.Axes)for(lat) plotPosit idx = 1:长度ion(player,lat(idx),lon(idx))end

Use the HERE HD Live Map (HERE HDLM) web service to read 3-D lane geometry data from a map tile. Then, plot the 2-D part of the data on an OpenStreetMap® basemap.

Create a HERE HDLM reader for a map tile ID representing an area of Berlin, Germany. If you have not previously set up HERE HDLM credentials, a dialog box prompts you to enter them.

tileID = uint32(377894435); reader = hereHDLMReader(tileID);

Add the OpenStreetMap basemap to the list of basemaps available for use with the HERE HDLM service. 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)

Read 3-D lane geometry data from theLaneGeometryPolylinelayer of the map tile. Plot the 2-D part of the lane geometry on theopenstreetmapbasemap.

laneGeometryPolyline = read(reader,'LaneGeometryPolyline'); gx = plot(laneGeometryPolyline); geobasemap(gx,'openstreetmap')

Zoom in on the central coordinate of the map tile.

latcenter = laneGeometryPolyline.TileCenterHere3dCoordinate.Here2dCoordinate(1); loncenter = laneGeometryPolyline.TileCenterHere3dCoordinate.Here2dCoordinate(2); offset = 0.001; latlim = [latcenter-offset,latcenter+offset]; lonlim = [loncenter-offset,loncenter+offset]; geolimits(latlim,lonlim)

Input Arguments

collapse all

HERE HDLM layer data to plot, specified as one of the layer objects shown in the table.

Layer Object Description Sample Plot
LaneGeometryPolyline

3-D lane geometry composed of a set of 3-D points joined into polylines.

LaneGeometryPolyline plot with boundaries, lane group reference, lane paths, and lane boundaries

LaneTopology

Topologies of the HD Lane model, including lane group, lane group connector, lane, and lane connector topologies. This layer also contains the simplified 2-D boundary geometry of the lane model for determining map tile affinity and overflow.

LaneTopology layer with boundaries, lane group connectors, and lane groups

TopologyGeometry

Topology and 2-D line geometry of the road. This layer also contains definitions of the links (streets) and nodes (intersections and dead-ends) in the map tile.

TopologyGeometry layer with boundaries, nodes, and links

To obtain these layers from map tiles selected by ahereHDLMReaderobject, use thereadfunction.

Geographic axes on which to plot data, specified as aGeographicAxesobject.2

Output Arguments

collapse all

Geographic axes on which data is plotted, returned as aGeographicAxesobject. Use this object to customize the map display. For more details, seeGeographicAxes Properties.

Version History

Introduced in R2019a

1You need to enter into a separate agreement withHEREin order to gain access to the HDLM services and to get the required credentials (access_key_id and access_key_secret) for using the HERE Service.

2Alignment of boundaries and region labels are a presentation of the feature provided by the data vendors and do not imply endorsement by MathWorks®.