Prev: Cell Row Concatenation
Next: Concatenate cell array of strings to a cell vector of strings horizontally
From: Nix Nicholson on 10 Jun 2010 08:03 I'm trying to add national borders to a regional map. I downloaded the TM national borders shapefile from: http://thematicmapping.org/downloads/world_borders.php % so first I tried plotting the land areas: worldmap({'Africa','India'}) land = shaperead('landareas.shp', 'UseGeoCoords', true); geoshow(land, 'FaceColor', [0.15 0.5 0.15]) % no problem % then I tried the rivers: rivers = shaperead('worldrivers', 'UseGeoCoords', true); geoshow(rivers, 'Color', 'blue') % also no problem, but then if I try the same procedure with the national borders ... borders = shaperead('TM_WORLD_BORDERS-0.3.shp', 'UseGeoCoords', true); geoshow(borders) % I get a whole heap of errors ??? Error using ==> trimPolygonToQuadrangle>mergeEndToEndPairs at 221 Inconsistent polygon topology: Encountered a chain of more than two connecting pairs. Error in ==> trimPolygonToQuadrangle>trimLongitudes at 111 [lon, lat] = mergeEndToEndPairs(lon, lat, lonlim, tolSnap); Error in ==> trimPolygonToQuadrangle at 45 [lat, lon] = trimLongitudes(lat, lon, lonlim, tolSnap); Error in ==> applyProjection>applyForward at 62 [lat, lon] = trimPolygonToQuadrangle( ... Error in ==> doApplyProj at 31 [x, y, savepts] = mproj.applyForward(mproj, mstruct, in1, in2, objectType); Error in ==> applyProjection at 14 outputs = doApplyProj(mproj, varargin{:}); Error in ==> bonne at 25 varargout = applyProjection(mproj, varargin{:}); Error in ==> sinusoid at 29 [varargout{:}] = bonne(varargin{:}); Error in ==> geovec at 21 [x, y] = feval(projName, mstruct, lat, lon, objectType, 'forward'); Error in ==> geostructshow>@(s,varargin)geovec(mstruct,s.Lat,s.Lon,objectType,fcn,varargin{:}) at 143 h = symbolizeMapVectors(S, symspec, @(s, varargin) ... Error in ==> symbolizeMapVectors>plotMapFeature at 128 h = plotfcn(s, props{:}); Error in ==> symbolizeMapVectors at 116 hg = plotMapFeature(S(k), hg, props, plotfcn); Error in ==> geostructshow at 143 h = symbolizeMapVectors(S, symspec, @(s, varargin) ... Error in ==> geoshow at 256 h = showFcn(varargin{:}); So, it seems the problem may be in how I treated the shapefile, or int he shapefiel itself. Does anyone know a national borders shapefile that works with these commands, or if not what I shoudl do with the one I downloaded to make it plottable? Many thanks for any help. I am quite a matlab amateur Lindsey
From: sscnekro on 10 Jun 2010 09:52
Would this work for you? http://www.mathworks.com/matlabcentral/fileexchange/8967 |