0

I'm having some trouble with the broom::tidy function. This might be specific to my shapefile (which is a map of all rivers in Alaska).

I load the file using the readOGR function

shp <- readOGR(dsn = ".","mv_navigable_water_ln")

And then fortify the spatial data into a data frame using the broom::tidy function.

shp_points <- tidy(shp, region="group")

Which all seems to work. When I plot the points using ggplot it gives me a map that spatially makes sense.

ggplot(data=shape_points, aes(x=long, y=lat, group=group)) +
  geom_path() +
  coord_fixed()

map of alaska rivers

However if you look at the axes the lat and long are in a format that I don't recognize. I don't see any obvious conversion factors for them either. Anyone else experience this?

Session info:
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
other attached packages:
1 broom_0.4.2 dplyr_0.7.4 rgeos_0.3-25 ggplot2_2.2.1 rgdal_1.2-13 sp_1.2-5

John Harley
  • 156
  • 1
  • 6

1 Answers1

0

After the first step

shp <- readOGR(dsn = ".","mv_navigable_water_ln")

Try transforming your CRS to EPSG:4326

library(sp)

shp <- spTransform(shp,"+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0")

And then follow the rest of your steps. Now your axes should be latitude and longitude in decimal degrees

iskandarblue
  • 7,208
  • 15
  • 60
  • 130
  • Thanks for your help! I received the following error message: Error in spTransform(xSP, CRSobj, ...) : No transformation possible from NA reference system – John Harley Oct 13 '17 at 19:05