I have two files: shapefile and raster, both in the same coordinate system in ArcGIS: EPSG 5514.
Check information on projection in ArcGIS for raster:
S-JTSK_Krovak_East_North
WKID: 5514 Authority: EPSG
Projection: Krovak
False_Easting: 0.0
False_Northing: 0.0
Pseudo_Standard_Parallel_1: 78.5
Scale_Factor: 0.9999
Azimuth: 30.28813975277778
Longitude_Of_Center: 24.83333333333333
Latitude_Of_Center: 49.5
X_Scale: -1.0
Y_Scale: 1.0
XY_Plane_Rotation: 90.0
Linear Unit: Meter (1.0)
Geographic Coordinate System: GCS_S_JTSK
Angular Unit: Degree (0.0174532925199433)
Prime Meridian: Greenwich (0.0)
Datum: D_S_JTSK
Spheroid: Bessel_1841
Semimajor Axis: 6377397.155
Semiminor Axis: 6356078.962818189
Inverse Flattening: 299.1528128
Check information on projection in ArcGIS for Shapefile:
S-JTSK_Krovak_East_North
WKID: 5514 Authority: EPSG
Projection: Krovak
False_Easting: 0.0
False_Northing: 0.0
Pseudo_Standard_Parallel_1: 78.5
Scale_Factor: 0.9999
Azimuth: 30.28813975277778
Longitude_Of_Center: 24.83333333333333
Latitude_Of_Center: 49.5
X_Scale: -1.0
Y_Scale: 1.0
XY_Plane_Rotation: 90.0
Linear Unit: Meter (1.0)
Geographic Coordinate System: GCS_S_JTSK
Angular Unit: Degree (0.0174532925199433)
Prime Meridian: Greenwich (0.0)
Datum: D_S_JTSK
Spheroid: Bessel_1841
Semimajor Axis: 6377397.155
Semiminor Axis: 6356078.962818189
Inverse Flattening: 299.1528128
in ArcGIS totally identical coordinate systems.
If I import them in R by
library(sp)
library(rgdal)
library(rgeos)
library(raster)
# import raster
r1<-raster("F:/.../r1_2013.img")
#import shp
d.shp <- readOGR(dsn = "F:/.../dummy_data_arcgis_r",
layer = "np_by_manag")
and I want to check data projection, there is difference in projection in my PREVIOUSLY IDENTICAL CRS:
> proj4string(r1) # RASTER
[1] "+proj=krovak +lat_0=24.83333333333333 +lon_0=49.5 +k=0.9999 +x_0=0 +y_0=0 +ellps=bessel +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"
> proj4string(d.shp) # SHAPEFILE
[1] "+proj=krovak +lat_0=49.5 +lon_0=24.83333333333333 +k=0.9999 +x_0=0 +y_0=0 +ellps=bessel +units=m +no_defs"
>
which cause problems in any spatial operation I want to perform further.
Why R modify my projection? Is it caused by various nature of my files: shapefile / raster? How can I get rid of it and which one of Krovak CRS is correct?
My aim, after finishing this transformations, is to:
- convert raster r1 to polygon p.r1,
- intersect polygon p.r1 with d.shp
- calculate areas of each polygon
# convert raster to polygon
p.r1<-rasterToPolygons(r1, dissolve = T)
# intersect polygon from raster with another one
int.r <-intersect(p.r1,d.shp)
# calculate areas (in m2) for every polygon in intersected shp
int.r$area <- sapply(int.r@polygons, function(x) x@Polygons[[1]]@area)
My dummy files are attached here: http://ulozto.sk/xKoewAzg/dummy-data-arcgis-r-zip