Shapefile distorted on World Map

6 views (last 30 days)
MCM
MCM on 9 Oct 2018
Commented: MCM on 10 Oct 2018
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)

Answers (1)

ANKUR KUMAR
ANKUR KUMAR on 10 Oct 2018
"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 Comment
MCM
MCM on 10 Oct 2018
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)

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!