Giter Club home page Giter Club logo

getcartr's People

Contributors

chrisbrunsdon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

getcartr's Issues

Issue with non-unique Polygons ID slot values

I am rather new in the field of making map. I am not therefore completely sure that my question concerns only the getcartr package.
I am trying to map Swiss states according to the elections résultat, and I have to deal in this sort of exercices with à states containing polygons with the same number in the key column i need to merge th sp objet with my data. Those duplicated polygons are differentiated with another columns, the usual plot don't make any issue.
But I failed to use the quick.carto function, with the error "invalid class "spatialpolygjns" object ; non-unique polygons ID slot value"

Is there any way to solve this error in the quick carto function ?

Thanks in advance for the help

sf instead of sp ?

Dear Chris,
I'am new to geocomputation with R, and I do not know how to use the function/methods belonging to the objects created/worked on by package sp. As I get a log of warning and error messages because of the changes in the PROJxxx libraries, I would like to use sf functions.
Is there a description of waht are the functions in your package - espacially the not exported dotted ones - are doing?
Or should I read the documentation of Rcartogram resp. the Newman/Gastner documention of the C-routine and redo the frontend on my own?

Best Wishes
Rolf

P.S.: I wonder if this question deserves the heading "Issues". If not please let me know where to put it instead.

Error in proj4string ... Geographical CRS given to non-conformant data

Hi there

First --- thanks for a really neat package.

I encountered a problem while running a variant of an example from http://vietletruc.com/tag/cartogram/. (on a Windows machine)

quick.carto fails with the following message.

d> world.carto <- quick.carto(world, world@data$Population, blur = 0)
Error in `proj4string<-`(`*tmp*`, value = <S4 object of class "CRS">) : 
  Geographical CRS given to non-conformant data: -189.000000 -192.188202  185.811798
Called from: stop(mess)

If I look at the world object which is a SpatialPolygonsDataFrame I find that it uses (as I expected) a longlat projection. And both the latitude and longitude values are all "legal".

d> world@proj4string
CRS arguments:
 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 
d> range(coordinates(world)[, 1])
[1] -178.1269  179.2159
d> range(coordinates(world)[, 2])
[1] -80.50275  78.60600
d> 

However if I overwrite the proj4string, and then try quick.carto again, everything is fine.

d> world@proj4string <- CRS(as.character(NA))
d> world.carto <- quick.carto(world, world@data$Population, blur = 0)
d> 

I suspect (but have no evidence) that somewhere in the internals of quick.carto a new expanded copy of the SpatialPolygonsDataFrame is made including the surrounding "sea" as described in the Gastner Newman paper. And that the copy simply uses the same proj4string / CRS as the map being morphed. And that when the longlat values are expanded, they exceed the legal values for longitudes and latitudes. Or perhaps simply that at some stage during the morphing process the (warped) long lat values for the cartogram exceed the legal values for longitude and latitude. Hence this error message, which I think comes from a validity check during the creation of a (copy of) SpatialPolygonsDataFrame, when the CRS is longlat .

If I am correct, wiping out the proj4string / CRS in the way I have above is actually the correct thing to do I think --- since after morphing it would be fair to say that the coordinate reference system of the warped map is no longer any type of longitude latitude projection (nor indeed any other projection likely to be known to standard geography and supported in the CRS / proj4 universe).

Not sure what to do, but maybe this issue will help others who may experience a similar problem.

Once again, really like the package, thanks.

Geoff

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.