필터 지우기
필터 지우기

How can I draw all boundaries of cities in Pennsylvania State, USA

조회 수: 10 (최근 30일)
Abdulmannan Ajabnoor
Abdulmannan Ajabnoor 2017년 9월 14일
댓글: Rajesh Balagam 2017년 9월 29일
I have draw a map for Pennsylvanya but I need to divide the map by cities. So, how can I do that? that what I did:
pennsylvania1 = shaperead('usastatelo',...
'UseGeoCoords', true,...
'Selector', {@(name)strcmpi('pennsylvania',name), 'Name'});
geoshow(pennsylvania1)

답변 (1개)

Rajesh Balagam
Rajesh Balagam 2017년 9월 19일
You need to download USA city/county shape file data for this. You can find it (USA_adm_shp.zip) here.
After extracting the data you can plot Pennsylvania state data as shown below.
data = shaperead('USA_adm2.shp','UseGeoCoords',true,'Selector',{@(name)strcmpi('pennsylvania',name),'NAME_1'});
geoshow(data)
  댓글 수: 2
Abdulmannan Ajabnoor
Abdulmannan Ajabnoor 2017년 9월 19일
Thank You so much
I tried to do it but this error happened
>> Untitled Error using openShapeFiles>checkSHP (line 67) Unable to open both USA_adm2.shp and USA_adm2.SHP.
Error in openShapeFiles (line 18) [basename, ext] = checkSHP(basename,shapeExtensionProvided);
Error in shaperead (line 208) = openShapeFiles(filename,'shaperead');
Error in Untitled (line 1) data = shaperead('USA_adm2.shp','UseGeoCoords',true,'Selector',{@(name)strcmpi('Pittsburgh',name),'NAME_2'});
Do I should to put all files under Matlap-->Toolbox-->map-->mapdata?
Thank You again
Rajesh Balagam
Rajesh Balagam 2017년 9월 29일
This error is produced when MATLAB couldn't find the specified file.
You need to change the MATLAB present working directory path to the directory where downloaded files are placed (or) copy the USA_adm2.shp file to your working directory.
Execute the above command after this.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by