[R-sig-Geo] Add interpolated coordinates to SpatialPolygons

Robert J. Hijmans r.hijmans at gmail.com
Thu Sep 9 14:36:10 CEST 2010


The makePoly function in 'geosphere' does this. Robert

On Thu, Sep 9, 2010 at 2:23 PM, Karl Ove Hufthammer <karl at huftis.org> wrote:
> Is there a simple way to add (lineraly interpolated) coordinates to
> SpatialPolygons; i.e., between each pair of connected points (coordinates),
> add a bunch of points that lie *on* the line connecting the two points?
>
> Here’s a very simple ASCII art example. I have a rectangle polygon:
>
> *--------------*
> |              |
> |              |
> |              |
> *--------------*
>
> To this I want to add more coordinates, to get:
>
> *--*--*--*--*--*
> |              |
> *              *
> |              |
> *--*--*--*--*--*
>
> The actual polygon would look identical when plotted. Of course my polygons
> are more complex (but non-self-intersecting).
>
> The reason I need this is that I want to transform simple shapes from one
> projection (e.g., latlong) to a different one (e.g., Mercator). If I do a
> simple spTransform, straight lines in one projection are projected into
> straight lines in the other projection, instead of into curves, which is how
> the original polygon *should* look if reprojected.
>
> I have tried searching for functions to do this, but it isn't easy to come
> up with the right search terms (given that such a function *does* exist).
>
> --
> Karl Ove Hufthammer
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list