Description Usage Arguments Details Examples
Returns an object of type SpatialPolygons
with a single feature.
1 2 3 | mBox(x, y, wktstring, size = 500, square = T, long.ratio = 1.618034,
landscape = T, proj.srid = "+init=epsg:3857",
gcs.srid = "+init=epsg:4326")
|
x |
Real value corresponding to longitude of a point (expected as WGS84 or |
y |
Real value corresponding to latitude of a point (expected as WGS84 or |
wktstring |
a WKT formatted point required if |
size |
radial size of box given in units for the given projection (see Details) |
square |
should a square box (of area 2*size^2) be returned; if |
long.ratio |
The factor for stretching the box along its long axis, configured by.... |
landscape |
whether to make the long dimension the horizontal (x) (default) or vertical |
proj.srid |
a |
Default behavior is a square polygon based on radial distance (specified by size
) in the unit of the projection spatial reference system. Default linear measure is in meters. Because it is defined radially a square buffer will have sides equal to 2x the size
argument.
If square = F
the size
argument will be scaled as a multiple of long.ratio
. If landscape = T
(default) is chosen, then the X-axis (horizontal) side will be longer. Note that square = F
implies a 1:1 correspondence between size
and the shortest side of the rectangle. In other words, if the size
argument is unchanged, the short side of a box from square = F
will be one half the length of the side of a box where square = T
. I could fix that pretty easily. But this works fine for me...
The function will return a polygon in the same coordinate system as the point given as input (specified as gcs.srid
). It makes no attempt to transform the spatial reference system of the input point. As of now, it's only been tested with points in WGS84 (epsg:4326
) lat/long (x = long, y = lat).
Note: The default (flawed) "Web Mercator" (EPSG:3857
) was chosen as the planar spatial reference system so as not to bias in favor of any world region. Since it is used here for area calculations and given the Mercator's well-known exaggeration of areas as latitudes get larger, an equal-area projection is recomended (e.g. in the U.S., the US National Atlas "+init=epsg:2163"
).
1 2 3 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.