How can I use maptrimp with openstreetmap land polygons?
2 views (last 30 days)
Show older comments
I am trying to trim down an area of the WGS84 openstretmap land polygon using 'maptrimp'. Data available at this link http://data.openstreetmapdata.com/land-polygons-complete-4326.zip .
Looks like maptrimp is the right function, but I am getting the following error when executing my code (pasted below) and have tried manipulating the longitude extents (currently -180 to 180) e.g. to -179 to 179 but that doesn't seem the cause. Can anyone assist me with what may be going on here? Thanks! Error using adjustPolarVertices>adjustPV (line 73) 361 polar vertices: Too many.
Error in adjustPolarVertices (line 31) [lat, lon] = adjustPV(lat, lon, poleLat, p, s, e);
Error in preprocessLatLonPolygons (line 21) [lat, lon] = adjustPolarVertices(lat, lon, southPoleLat, tolSnap);
Error in trimPolygonToQuadrangle (line 41) [lat, lon] = preprocessLatLonPolygons(lat, lon, tolSnap, tolClose);
Error in maptrimp (line 31) [lat, lon] = trimPolygonToQuadrangle(...
CODE
%% read shape shppath = 'J:\GIS_data\General_map_data\Openstreetmap\land-polygons-complete-4326\land_polygons.shp'; [S, ~] = shaperead(shppath); xco = cell2mat({S.X})'; yco = cell2mat({S.Y})'; plot(xco, yco, 'b-');
%% AOI coordinates latlim = [-50 50]; lonlim = [-100 50];
%% Trim lat and longs [latTrimmed, lonTrimmed] = maptrimp(yco, xco, latlim , lonlim); plot(lonTrimmed, latTrimmed, 'r-');
0 Comments
Answers (0)
See Also
Categories
Find more on Elementary Polygons in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!