Shapefile distorted on World Map

조회 수: 5 (최근 30일)
MCM
MCM 2018년 10월 9일
댓글: MCM 2018년 10월 10일
Hello,
I have two shapefiles that are projected correctly on the "flat map" but get distorted when I project them on World Map. I'm assuming this is a simple projection problem but I'm not sure if it is an issue with my shapefiles or with how I'm projecting onto World Map. In the images, the grey areas represent my two shapefiles.
"Flat Map" Code:
geoshow('landareas.shp', 'FaceColor', [0.5 0.7 0.5],'DefaultEdgeColor', 'k');
geoshow('Shape1.shp','facealpha',.5)
geoshow('Shape2.shp','facealpha',.5)
World Map Code:
ax = worldmap('World');
land = shaperead('landareas', 'UseGeoCoords', true);
geoshow(ax, land, 'FaceColor', [0.5 0.7 0.5])
afr=shaperead('shape1','UseGeoCoords',true);
geoshow(ax,afr,'FaceColor',[0.5,.5,.5],'FaceAlpha',0.5)
south=shaperead('shape2','UseGeoCoords',true);
geoshow(ax,south,'FaceColor',[0.8,.8,.8],'FaceAlpha',0.5)

답변 (1개)

ANKUR KUMAR
ANKUR KUMAR 2018년 10월 10일
"I'm not sure if it is an issue with my shapefiles or with how I'm projecting".
Its only because of projection, the continental boundaries seems to be slight tilted towards the pole. You can use m_map to plot these things. m_map does the thing in an efficient manner along with the overlying contour in all projections. Have a look over m_map html sample documentation .
Or you can use shaperead command to read longitude - latitude values and plot using simple plot command.
  댓글 수: 1
MCM
MCM 2018년 10월 10일
I did use the shaperead command originally (see code in my original post). But per your suggestion I tried using a simple plot command instead of geoshow. It made no difference. I used plotm because plot did nothing.
My instincts tell me that I need to "re-project shapefile onto worldmap's reference coordinate system" but I'm not sure how to do that.
worldmap('world')
afr = shaperead('shape1.shp')
plotm(afr.Y,afr.X)
south=shaperead('shape2.shp')
plotm(south.Y, south.x)

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

Community Treasure Hunt

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

Start Hunting!

Translated by