%% Import Zenrin Japan Map 3.0 (Itsumo NAVI API 3.0) Roads Using Specified Region
% Import Zenrin Japan Map 3.0 (Itsumo NAVI API 3.0) road network data into a driving scenario. Select this data from a region that is centered around a specified geographic coordinate.
% Define latitude and longitude coordinates corresponding to a park.

latCenter = 35.6889;
lonCenter = 139.8458;

% Specify the minimum and maximum latitude and longitude coordinates for a rectangular region around the park. Display a bounding box corresponding to this region on a geographic plot.

offset = 0.0013;
minLat = latCenter - offset;
minLon = lonCenter - offset;
maxLat = latCenter + offset;
maxLon = lonCenter + offset;

figure
gx = geoaxes;
LineSpec = '.-k';
geoplot(gx, ... 
        [minLat maxLat],[minLon minLon],LineSpec, ...
        [maxLat maxLat],[minLon maxLon],LineSpec, ...
        [maxLat minLat],[maxLon maxLon],LineSpec, ...
        [minLat minLat],[maxLon minLon],LineSpec)

% Create a driving scenario and import roads from the region by using the minimum and maximum coordinates. The roadNetwork function imports roads that are at least partially within this region.

scenario = drivingScenario;
roadNetwork(scenario,'ZenrinJapanMap',minLat,minLon,maxLat,maxLon) 

%
% Plot the scenario. To maintain the same alignment with geographic coordinate displays, the X-axis is on the bottom and the Y-axis is on the left. In driving scenarios not imported from maps, the X-axis is on the left and the Y-axis is on the bottom. This alignment is consistent with the Automated Driving Toolbox™ world coordinate system.

figure
plot(scenario)

% Copyright 2020 The MathWorks, Inc.