1

I am learning the leaflet package and am running into a snag. To learn the package I am using the Snow deaths dataset from the package HistData which contains historic Cholera deaths from an epidemic.

When I run the following code the deaths plot correctly put the map layer underlying the dots is Africa rather than London. Any tips on correcting this?

# John Snow Cholera data
library(leaflet)
library(HistData)
library(sp)

data(Snow.deaths)
coordinates(Snow.deaths) <- x+y
proj4string(Snow.deaths) <- CRS("+init=epsg:3109")

leaflet(Snow.deaths) %>% addTiles() %>%
  addCircles(lng = ~y, lat = ~x, weight = 1,
             radius = ~3000, popup = ~case
  )
  • My guess would be a problem with the coordinates. Can you post your data? – BDD Jul 8 '15 at 14:02
  • would be happy too. Is there a way to upload data using this site? or should I just paste an extract in the comments ? alternatively if you are ok with installing a package the data is : library(HistData) data(Snow.deaths) – nevin krishna Jul 8 '15 at 14:29
3

help(Snow.deaths) says:

 The scale of the source map is approx. 1:2000.  The ‘(x, y)’
 coordinate units are 100 meters, with an arbitrary origin.

so I don't know why you think EPSG:3109 is going to help you, that seems to be Jersey transverse mercator... http://epsg.io/3109

To properly georeference these you'll need to find the lat-long of the arbitrary origin and construct a proj4 string with that origin. The small spatial range of the data probably means a transverse mercator will do the job.

Or you could find a readily-georeferenced John Snow cholera data set... I'm sure there's one about....

http://blog.rtwilson.com/john-snows-cholera-data-in-more-formats/

might help.

  • 1
    Thanks so much for the response. I will try and find a geo-referenced dataset. – nevin krishna Jul 8 '15 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.