MATLAB Answers

0

How to fill coastline polygon

Millo Marin さんによって質問されました 2011 年 9 月 8 日
最新アクティビティ Chad Greene
さんによって 回答されました 2016 年 5 月 5 日
Does anyone knows how to fill a coastline polygon? I'm trying to make SST contourf maps for the Mexican Pacific, but I don't know how to superimpose the filled "ground", so it covers the contours of the gridded area, where I don't have any oceanographic stations. I'll apreciate if anyone could tell me how to do it. Thank you.

  0 件のコメント

サインイン to comment.

7 件の回答

Rob Comer
回答者: Rob Comer
2011 年 9 月 8 日

Mapping Toolbox has two functions for plotting filled polygons: geoshow and mapshow, as well as a low-resolution coastline data set, coast.mat. Use geoshow when working with a projected map axes. For example, if you load coast like this: coast = load('coast.mat'), then you could call geoshow like this: geoshow(coast.lat, coast.long, 'DisplayType','polygon','FaceColor','green').
You mentioned contourf (rather than contourfm), so you're probably in a ordinary axes. In that case, use mapshow instead, and swap the order of the first two inputs. For example: mapshow(coast.long, coast.lat, 'DisplayType','polygon','FaceColor','green').
As Mark mentioned in his answer, one way to work in higher resolution is to import GSHHS coastline data via the gshhs function.

  0 件のコメント

サインイン to comment.


回答者: Mark Brandon 2011 年 9 月 8 日

Millo,

if you have the mapping toolbox then you can use tools such as gshhs

http://www.mathworks.co.uk/help/toolbox/map/ref/gshhs.html

But if not then you can use the tools in m_map which is an excellent package

http://www.eos.ubc.ca/~rich/map.html

There are many tools (and examples) in that package which you can use.

Else you could get the coastline from the NOAA Coaslie extracter

http://www.ngdc.noaa.gov/mgg/coast/ and make your own patch.

Or you can use the tools the WHOI Sea-Mat Page

http://woodshole.er.usgs.gov/operations/sea-mat/

And look at the code under the map_stuff link which sends you here

http://woodshole.er.usgs.gov/operations/sea-mat/mapstuff-html

Lots of choices for you to try.

Good luck, Mark

  2 件のコメント

Millo Marin 2011 年 9 月 8 日
I have my own coastline from the coastline extractor (NOAA)... how do I make the patch? Sorry, I'm new at MATLAB. Thanks a lot.
xiao gh
2011 年 9 月 19 日
it's interesting

サインイン to comment.


回答者: Millo Marin 2011 年 9 月 8 日

I have the data for the coastline, I extracted it from the NOAA coastline extractor.. when I plot the contourf interpolated plot, I use the hold on comand, then plot the coastline over the contourf plot. I do have the mapping toolbox, I tried with the mapshow option, but it draws the coastline as a polygon, and I miss some of the resolution in the coastline (like bays and capes). I don't know if I can upload an image of the plot, so yo guys can see it and better understand my problem.. Sorry, I'm really new at Matlab. Thanks a lot!

  0 件のコメント

サインイン to comment.


回答者: Mark Brandon 2011 年 9 月 9 日

It sounds like you are getting this sort of thing
If you have followed that path Millo then you should follow the m_map link I posted above - and the sea-mat page.
You could try "patch" instead of contourf.
Personally I would recommend that you you look at the (free) m_map toolbox function "m_gshhs_h" described in example 11 on this page
for example here are the different resolutions in the GSHHS
There will be a bit of downloading of the gshhs data but I think it is worth it.
good luck. Mark

  0 件のコメント

サインイン to comment.


回答者: Millo Marin 2011 年 9 月 19 日

Sorry guys, I have been really busy latelly.. yes, that is exactly what I'm getting. I already have the m_map toolbox, I just haven't had the time to get into it... thanks a lot!

  0 件のコメント

サインイン to comment.


回答者: Mark Brandon 2011 年 9 月 19 日

You could "accept" an answer Millo then to close the question ;-)
cheers. Mark

  0 件のコメント

サインイン to comment.


Chad Greene
回答者: Chad Greene
2016 年 5 月 5 日

Two more options:
1. If you're trying to mask grid cells that are in land, use landmask.
2. If you want to place a patch object on top of gridded data, use borders.

  0 件のコメント

サインイン to comment.



Translated by