Hello,
I have a .shp file of the country Ireland.
I read the file into matlab using the code:
S = shaperead('Ireland.shp')
My question is how can I view the map?
I would appreciate it if anybody had the time to show me.
Also, is it possible to overlay GPS data on a file of this type?
Thank you

댓글 수: 1

alessio grechi
alessio grechi 2018년 10월 18일
편집: alessio grechi 2018년 10월 18일
ciao. Sei riuscito a far visualizzare la mappa in MatLab?

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

 채택된 답변

José-Luis
José-Luis 2012년 12월 24일

2 개 추천

doc mapshow
It can be as simple as:
S = shaperead(filename);
mapshow(S);
As long as you have latitude and longitude, you can plot pretty much anything
doc plotm

댓글 수: 6

Hello,
Thank you very much for your reply, I was able to display the map.
This is a screenshot
Could I ask you one further question?
As an example, I would like to plot a point for Dublin (the capital city).
This is the code I am using.
S = shaperead('ireland.shp');
mapshow(S);
hold on
h = plotm(53.34419, -6.26751)
However, I getting an error:
Error using gcm Not a map axis
Thank you for your time
J
The short answer:
Use plot instead of plotm
The longer answer:
plotm is complaining that the current axes are not map axes. Map axes are better since they can handle projections and will not distort your data as vanilla axes will do. So, if you want to be thorough, first create an axesm object and plot your shapefile and point on it.
doc axesm
John
John 2012년 12월 24일
Thank you for your help. Happy Christmas
José-Luis
José-Luis 2012년 12월 24일
My pleasure.
John
John 2012년 12월 24일
편집: John 2012년 12월 24일
Hello,
When I use the plot function the point does not appear to be displayed on the map. I can't see it.
Also, I tried the other method, I displayed the map and typed "axesmui" but it says "not a map axis".
Can I ask the question, is the map I have suitable for overlaying latitude and longitude data on it. The axes scales don't seem to be in lat long format. Are they?
Would you know where I could source a suitable map?
What I am trying to do is overlay GPS data from a car on map and reproduce something like this:
I appreciate your help.
Thanks
J
If you are plotting a point, are you sure your Marker is large enough so you can see it, try a large size first
plot(x,y,'LineStyle','none','Marker','o','MarkerSize',20);
The map you are linking to does not appear to be in lat-long, it looks like UTM.
I don't know where you could find a suitable map, but google can help you. You could also look at worldmap() from Matlab.

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

추가 답변 (2개)

John
John 2012년 12월 25일

0 개 추천

Hi Jose,
Thank for your help with this. I managed to get it working in the end. I sourced a better map using your suggestion worldmap().
I have one further question if you don't mind.
I am getting this map using the code below.
ax = worldmap('ireland');
land = shaperead('landareas', 'UseGeoCoords', true);
geoshow(ax, land, 'FaceColor', [0.5 0.7 0.5])
How can I just limit the display to just display between Lat 51-55.5 and long 5-10.5. I just want to display Ireland.
Thank you
J

댓글 수: 5

José-Luis
José-Luis 2012년 12월 25일
편집: José-Luis 2012년 12월 25일
ax = axesm('MapProjection','mercator','MapLatLimit',[50 55.5],...
'MapLonLimit',[-10.5 -5],'Frame','on')
land = shaperead('landareas', 'UseGeoCoords', true);
geoshow(ax, land, 'FaceColor', [0.5 0.7 0.5])
Please read the documentation about axesm() if you want to tweak the display.
John
John 2012년 12월 25일
Thanks very much
John
John 2012년 12월 25일
Hi,
I got this to work very well. Thanks for your help.
Can I ask you is it possible to use the colourmap editor on maps? I tried to use it to display areas with varying amounts of data in a different colours but it all stays blue.
Would you have any suggestions?
Thank you
J
doc plotm
Maybe you could use the geolimit function

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

Clelia Massarino
Clelia Massarino 2018년 9월 20일

0 개 추천

Hello,
I am having problem displaying the Germany map. My final goal is to have one with the elevation or at least different colors to discern different altitudes. I used the same code of you but it starts running endlessly. Any suggestion?

댓글 수: 1

Alessandro Mura
Alessandro Mura 2021년 12월 21일
@Clelia Massarino sei riuscito a cambiare i diversi colori della mappa della Germania? se si ti posso chiedere per favore lo script?
ti ringrazio

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

카테고리

도움말 센터File Exchange에서 Mapping Toolbox에 대해 자세히 알아보기

질문:

2012년 12월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by