How to fill coastline polygon

조회 수: 36 (최근 30일)
Millo Marin
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.

답변 (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.

Mark Brandon
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
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
xiao gh 2011년 9월 19일
it's interesting

댓글을 달려면 로그인하십시오.


Millo Marin
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!

Mark Brandon
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

Millo Marin
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!

Mark Brandon
Mark Brandon 2011년 9월 19일
You could "accept" an answer Millo then to close the question ;-)
cheers. Mark

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.

카테고리

Help CenterFile Exchange에서 Map Display에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by