MATLAB Answers

Shapefile distorted on World Map

9 views (last 30 days)
MCM on 9 Oct 2018
Commented: MCM on 10 Oct 2018
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');
World Map Code:
ax = worldmap('World');
land = shaperead('landareas', 'UseGeoCoords', true);
geoshow(ax, land, 'FaceColor', [0.5 0.7 0.5])

Answers (1)

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 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.
afr = shaperead('shape1.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!