clc;close all;clear; road=shaperead('boston_roads.shp'); %讀取shape文件 figure, mapshow('boston.tif'); %讀取tif遙感影像並顯示 axis image manual off; %關閉本地坐標系統 surveyFeetPerMeter = unitsratio('sf','meter'); %將米級單位轉換成surveyFeet單位 colorTab='rgbcymkw'; %顏色代碼表,不同等級的公路顯示不同顏色 for i=1:numel(road) x = surveyFeetPerMeter * [road(i).X]; %將shp文件坐轉換為tif文件坐標 y = surveyFeetPerMeter * [road(i).Y]; mapshow(x,y,'Color',colorTab(road(i).CLASS)); %根據公路類別來進行不同顏色顯示 end print('-dpng','-r600','d:/boston.png'); %以600的分辨率保存結果圖片