Problem in reading .shp file

Hi,
I have a problem in reading .shp file.
My .shp file contains all the major cities in Australia.
I want to read all the major cities located in the state of Queensland only.
I've tried to write code
shapedir = fullfile (pwd, 'Shapefile');
main_cities = shaperead (fullfile (shapedir, 'MainCities.shp'), 'usegeocoords', true);
But after this, I do not know how to do it.
When I opened the variable in the variable editor, I find a field named 'state', containing the name of different states in each struct.
Can someone help me? thank you

 채택된 답변

Chandra Kurniawan
Chandra Kurniawan 2012년 1월 9일

1 개 추천

Hi, Raymond
You can perform that by adjusting the selector parameter.
I'll give you sample code :
shapedir = fullfile(pwd,'Shapefile');
main_cities = shaperead(fullfile(shapedir,'MainCities.shp'), ...
'usegeocoords',true,'selector', ...
{@(name) strcmp(name,'Queensland'),'state'});

댓글 수: 3

Raymond Enovan
Raymond Enovan 2012년 1월 9일
Thank you, sir
But when I try to open it from mapviewer,
the results do not seem so obvious.
How can I set this?
Chandra Kurniawan
Chandra Kurniawan 2012년 1월 9일
Then you need to create the 'symbolspec'
Eq :
cities_spec = makesymbolspec('point',{'default','marker','o',...
'markeredgecolor','r',...
'markerfacecolor','b'});
Then form mapviewer, you can set the symbolspec from 'layer' menu.
Raymond Enovan
Raymond Enovan 2012년 1월 9일
Thank you, sir

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB Compiler SDK에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by