How to fill coastline polygon

13 visualizaciones (últimos 30 días)
Millo Marin
Millo Marin el 8 de Sept. de 2011
Respondida: Chad Greene el 5 de Mayo de 2016
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.

Respuestas (7)

Rob Comer
Rob Comer el 8 de Sept. de 2011
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 el 8 de Sept. de 2011

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 comentarios
Millo Marin
Millo Marin el 8 de Sept. de 2011
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 el 19 de Sept. de 2011
it's interesting

Iniciar sesión para comentar.


Millo Marin
Millo Marin el 8 de Sept. de 2011
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 el 9 de Sept. de 2011
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 el 19 de Sept. de 2011
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 el 19 de Sept. de 2011
You could "accept" an answer Millo then to close the question ;-)
cheers. Mark

Chad Greene
Chad Greene el 5 de Mayo de 2016
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.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by