0

I'm stuck with what I think it a problem of not knowing how to find the right projection input for my state plane (Alaska State Plane Zone 4 NAD83 Feet) to use with function sp::CRS.

I'm following the directions for converting from a state plane at: Convert latitude/longitude to state plane coordinates

and I've looked into ?CRS which took me to http://trac.osgeo.org/proj/ from References but I can't even tell if this site is going to have what I need.

I'm using Hadley Wickham's tutorial for plotting shapefiles at: https://github.com/hadley/ggplot2/wiki/plotting-polygon-shapefiles

And I can plot any of the shapefiles I like from: http://munimaps.muni.org/moagis/download.htm

My code:

require(rgdal)
require(maptools)
require(ggplot2)
require(plyr)

  my_dsn <- "directory where the shapefile is"
  Assembly = readOGR(dsn=my_dsn, layer="assembly")
  Assembly@data$id = rownames(Assembly@data)
  Assembly.points = fortify(Assembly, region="id")
  Assembly.df = join(Assembly.points, Assembly@data, by="id")
  Assembly@data$id = rownames(Assembly@data)
  Assembly.points = fortify(Assembly, region="id")
  Assembly.df = join(Assembly.points, Assembly@data, by="id")
  #Assembly.df$DISTRICT <- factor(Assembly.df$DISTRICT)

  ggplot(Assembly.df) + 
  aes(long,lat,group=group) + 
  geom_path(color="black") +
  coord_equal() 

Please help me find the input I need to convert projections. I'm new to working with map projections.

Community
  • 1
  • 1
cylondude
  • 1,816
  • 1
  • 22
  • 55
  • 1
    What does proj4string(Assembly) report directly after the readOGR line? If not NA you are good to go with ?spTransform, all that other stuff is unhelpful – mdsumner Feb 20 '14 at 21:14
  • The output is "+proj=tmerc +lat_0=54 +lon_0=-150 +k=0.9999 +x_0=500000.0000000001 +y_0=0 +datum=NAD83 +units=us-ft +no_defs +ellps=GRS80 +towgs84=0,0,0" – cylondude Feb 20 '14 at 22:04
  • I'm guessing googlemaps uses a Mercator projection. How would I find the input for CRS() for this projection? – cylondude Feb 21 '14 at 00:31

1 Answers1

0

I recommend looking into using OGR2OGR via FWTools (within GDAL, which I see you're importing). You should be able to utilize these tools to project from one projection to another.

It should be a simple command line operation, such as ogr2ogr -f "ESRI Shapefile" original.shp wgs84.shp -s_srs EPSG:27700 -t_srs EPSG:4326

http://www.mercatorgeosystems.com/blog-articles/2008/05/30/using-ogr2ogr-to-re-project-a-shape-file/

csterling
  • 704
  • 3
  • 7
  • 18
  • You can avoid ogr2ogr if using R, not necessarily preferable but that was asked for here. Also, FWTools is hopelessly out of date, better to use OSGeo4W or other recent builds for Windows. – mdsumner Feb 20 '14 at 21:18