2017-09-25 1 views
1

http://www1.kew.org/gis/tdwg/index.html에서 TDWG 레벨 4 모양을 다운로드했습니다. 이 모양에는 WGS84 투영법이 있습니다. 이 레이어를 유럽의 LAEA 또는 CRS ("+ init = epsg : 3035")에 다시 투영해야합니다. R spTransform 투영 된 점이 유한하지 않음

나는 다음과 같은 코드를 사용 :

TDWG4 <- readOGR("D:/GIS/Administrative/world/TDWG/level4/level4.shp", layer="level4") 
TDWG4.LAEA <- spTransform(TDWG4, CRS("+init=epsg:3035")) 

을하고 다음 오류 얻을 :

Error in .spTransform_Polygon(input[[i]], to_args = to_args, from_args = from_args, : failure in Polygons 37 Polygon 1 points In addition: Warning message: In .spTransform_Polygon(input[[i]], to_args = to_args, from_args = from_args, : 361 projected point(s) not finite

어떤 제안이 문제를 해결하기를?

답변

0

사용 sf이 크게 rgdal/rgeos 대체 것처럼 : EPSG (3035)에 대한

install.packages("rmapshaper") 
library("rmapshaper") 
tdwg4.laea = rmapshaper::ms_clip(
    tdwg4.laea, 
    bbox = c(2426378.0132, 1528101.2618, 6293974.6215, 5446513.5222)) 

경계 상자는 경우 : 3035 EPSG는 유럽에만 관련이 있기 때문에 우리는 지금 지역을 클립해야

# install.packages("sf") 
library("sf") 
tdwg4.laea = sf::read_sf("level4.shp") # assumes in project root 
tdwg4.laea = sf::st_transform(tdwg4.laea, 3035) 

을 로부터 : http://spatialreference.org/ref/epsg/etrs89-etrs-laea/

이제 플롯 :

plot(tdwg4.laea) 

Plot of Europe

+0

거의 있습니다. 나는 유럽에 초점을 맞춘 변환 된 모양을 그릴 때 : plot (TDWG4.LAEA [ 'Level4_cod'], xlim = c (943611, 8500000), ylim = c (600000, 7800000)) 다음과 같은 오류 메시지가 나타납니다. : polypath (p_bind (L), 국경 = 국경 [I], lty = lty [I], LWD =의 LWD는 [I]에서 오류 : 잘못된 그래픽 경로 모든 제안을 –

+0

@NielsRaes는 대신 ggplot 시도 (ggplot2 ") # ggplot2','ggplot (data = TDWG4.LAEA) + geom_sf()'의 dev 버전이 필요합니다.? – Phil

+0

while (기본 플롯의) devtools :: install_github ("tidyverse/ggplot2 " devtools를 사용하여 설치된 ggplot2를 엽니 다.이 오류가 발생합니다. _Error : get (Info [i, 1], envir = env)에서 'ggplot2'에 대한 패키지 또는 네임 스페이스로드가 실패했습니다 : lazy-loa d 데이터베이스 'D : /R/library/ggplot2/R/ggplot2.rdb'가 손상되었습니다. 일반 ggplot2 라이브러리와'ggplot2 :: ggplot (data = TDWG4) + geom_sf()'를 사용할 때 오류가 발생합니다 : geom_sf()에서 _Error : 함수 "geom_sf"_을 찾을 수 없습니다. 더 이상의 제안? –

관련 문제