Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stencil from SpatialPolygons or SpatialPolygonsDataFrame #291

Closed
ghost opened this issue Aug 4, 2016 · 6 comments
Closed

stencil from SpatialPolygons or SpatialPolygonsDataFrame #291

ghost opened this issue Aug 4, 2016 · 6 comments

Comments

@ghost
Copy link

ghost commented Aug 4, 2016

Getting the following errors when passing a class SpatialPolygons or SpatialPolygonsDataFrame to simplegeom:

stencil <- simplegeom(a)
Error in as(.Object, "simplegeom") :
no method or default for coercing “SpatialPolygons” to “simplegeom”

stencil <- simplegeom(MSA)
Error in as(.Object, "simplegeom") :
no method or default for coercing “SpatialPolygonsDataFrame” to “simplegeom”

class(a)
[1] "SpatialPolygons"
attr(,"package")

class(MSA)
[1] "SpatialPolygonsDataFrame"
attr(,"package")
[1] "sp"

@jordansread
Copy link
Contributor

@ghost sorry, just saw this. The method to coerce sp into a simplegeom is a bit of a mess - this is something that can be done with the existing package, but it isn't exposed because I don't yet have a good way to make sure the projections of the sp objects that exist can be handled by the processing. I would like to take care of this, just hadn't run into a user yet that needed it. what is the CRS you are using?

@jhollist
Copy link

jhollist commented Oct 19, 2016

@jread-usgs +1 on this!

And I think I understand the projection issue you mentioned. Could you just require a specific projection and let the user deal with the transformation or am I missing something (likely)?

@jordansread
Copy link
Contributor

Yep, you got it Jeff, or I could support a few common ones with a look up and fail with a descriptive error when it isn't supported. That way people could easily PR a new proj

@jordansread
Copy link
Contributor

jordansread commented Oct 24, 2016

Here is where the WGS84 is hardcoded in for simplegeom: https://github.com/USGS-R/geoknife/blob/7361b82d5ac0ec4f5ebb4c724143ebc1d18a427e/R/processInputsToXML.R#L200

I think we can work on the

setMethod("simplegeom", signature("Spatial"), function(.Object, ...) {
})

method so that using SPdfs and the like is intuitive @jhollist and @ghost

@jordansread
Copy link
Contributor

BTW, when this is implemented initially, it will only support SpatialPolygons or SpatialPolygonsDataFrame objects because SpatialPoints will need a little bit different treatment.

jordansread pushed a commit to jordansread/geoknife that referenced this issue Oct 25, 2016
jordansread pushed a commit to jordansread/geoknife that referenced this issue Oct 25, 2016
jordansread pushed a commit to jordansread/geoknife that referenced this issue Oct 28, 2016
jordansread pushed a commit that referenced this issue Oct 29, 2016
@jordansread
Copy link
Contributor

This is implemented and on the current CRAN version. Feedback welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants