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

Discussion: switch to sf? #134

Closed
Robinlovelace opened this issue Nov 3, 2016 · 12 comments
Closed

Discussion: switch to sf? #134

Robinlovelace opened this issue Nov 3, 2016 · 12 comments

Comments

@Robinlovelace
Copy link
Member

Robinlovelace commented Nov 3, 2016

Wondering about the costs and benefits of doing this sooner rather than later.

Thoughts @edzer? One advantage I can think of: we could refactor lots of messy sp code and learn sf in depth.

@edzer
Copy link
Contributor

edzer commented Nov 3, 2016

Way to go, Robin!

More realistically, simple features do not represent networks, so creating, managing and analyzing networks still remains to be done. An advantage would be that you can constrain to LINESTRINGs between nodes, this is something sp cannot do - it only represents MULTILINESTRINGs (which, of course, can be of length 1 - this is the current splanr approach IIRC).

@Robinlovelace
Copy link
Member Author

Thanks for that - yes limiting it to LINESTRINGS will have advantages and creates a good basis for classes representing roads etc if we want to go that way (not sure we do...). One to think about anyway...

@richardellison
Copy link
Collaborator

I was thinking about this the other day. Networks are clearly important I think.

If we're adopting sf then we could potentially use the PostGIS topology model (that converts simple features into topologies) in some way.

@edzer
Copy link
Contributor

edzer commented Nov 7, 2016

GDAL has GNM; is that useful? Does it connect to the PostGIS topology model?

@richardellison
Copy link
Collaborator

I hadn't seen GNM before. It seems a driver could be written to connect GNM to PostGIS. GNM may be the more appropriate choice though as sf uses GDAL.

Is GNM consistent with the structure of sf?

@edzer
Copy link
Contributor

edzer commented Nov 7, 2016

I haven't looked into that; my assumption is that edges will be features, but a network must consist of nodes, edges, and their graph/topology.

@richardellison
Copy link
Collaborator

Yes, I agree that it would be most likely for edges to be features. I suppose you could add additional columns to represent the connecting nodes (anode, bnode). It would then need additional functions to calculate shortest paths, identify weights (could be yet another column), etc.

@Robinlovelace
Copy link
Member Author

Suggested policy: implement all new features that are easily implementable with sf in sf then add an argument sf_out = FALSE which means we'll return an sp object by default unless the user specify otherwise. That way:

  1. We don't force people to use these strange things called simple features until they're good and ready (and the package is ready for the prime time).
  2. We get to learn sf Wahey.
  3. The user gets faster code :)

What do you reckon to this @richardellison?

@edzer are there any issues you know of with setting sf as an import? I.e. is it a pain to install on some computers?

Possible knock-on benefit: will increase knowledge of this new paradigm for spatial data in R and encourage people to upgrade their GDAL version!

@edzer
Copy link
Contributor

edzer commented Nov 9, 2016

The MacOS ports are not yet on CRAN, meaning install.packages("sf") will not work there (Simon Urbanek's build farm is still at gdal 1.11)

@Robinlovelace
Copy link
Member Author

Ah OK, makes sense for that to get sorted then I guess. Ta 4 the info.

@richardellison
Copy link
Collaborator

Sounds reasonable but we should wait for MacOS ports unless there is a way of only optionally including it? In other words, check if sf is installed (or available on CRAN) and if not use sp only.

@Robinlovelace
Copy link
Member Author

Agreed. Good discussion. Closing for now and keep an eye open for sf Mac ports!

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

No branches or pull requests

3 participants