gshhs.lua


NAME
    gshhs

FUNCTION
    gshhs(tbl)

NOTES
    Reads map data from a GSHHS file.

INPUTS
    tbl - table that may has keys of
        file     - file that contains GSHHS data
        xmin     - start longitude (default = 0)
        xmax     - end longitude (default = 360)
        ymin     - start latitude (default = -90)
        ymax     - end latitude (default = 90)
        z        - the z-value for 3D plot (default = 0)
        category - land, lake, island, or pond (default = land)

OUTPUTS
    an array object that contains longitude, latitude, and z-value

    Example:
    arr = gshhs({file = "gshhs_c", xmin = 120, xmax = 180, ymin = 10, ymax = 80})

SOURCE

function gshhs(tbl)
	local xmin = 0
	if (tbl.xmin) then xmin = tbl.xmin; end
	local xmax = 360
	if (tbl.xmax) then xmax = tbl.xmax; end
	local ymin = -90
	if (tbl.ymin) then ymin = tbl.ymin; end
	local ymax = 90
	if (tbl.ymax) then ymax = tbl.ymax; end
	local category = "land"
	if (tbl.category) then category = tbl.category; end
	local z = 0
	if (tbl.z) then z = tbl.z; end
	
	local arr, bio = zeUtl.new("double", "bio")
	bio:open(tbl.file)
	bio:gshhs(category, xmin, xmax, ymin, ymax, arr)
	arr:insert(2, z)
	
	return arr
end