kkopczewska / spatial_book

Data and R codes to book on spatial data analysis
26 stars 30 forks source link

Error when changing poviat projection #2

Open Camil88 opened 2 years ago

Camil88 commented 2 years ago

Hello, I have faced strange problem when trying to change poviat projection (Chapter 2.1.). I run this code:

pow <- readOGR(dsn = 'C:/Users/mainUser/Desktop/spatial_book-master/powiaty', layer = 'powiaty')
pow <- spTransform(pow, CRS('+proj=longlat +datum=NAD83'))

and the following error comes up:

Error in if (is.projected(obj)) { : missing value where TRUE/FALSE needed In addition: Warning message: In spTransform(xSP, CRSobj, ...) : NULL source CRS comment, falling back to PROJ string

I had some initial problems with powiaty files but downloaded updated .zip version from link given in Readme - and I read it to R. However, the error as above shows up.

kkopczewska commented 2 years ago

Hi,

sorry for the delay but I am for offline winter break.

My code that always works is as follows:

pow<-readOGR(".", "powiaty") # map as object

pow<-spTransform(pow, CRS("+proj=longlat +datum=NAD83")) # change of projection

and try that map: https://www.sugarsync.com/pf/D1836703_09668593_6847342 (that is from my cloud)- that should work

best KK


dr hab. KATARZYNA KOPCZEWSKA, prof.ucz. / Associate professor Katedra Statystyki i Ekonometrii / Chair of Statistics and Econometrics

WYDZIAŁ NAUK EKONOMICZNYCH / Faculty of Economic Sciences UNIWERSYTET WARSZAWSKI / University of Warsaw Długa 44/50, 00-241 Warszawa / 44/50 Dluga street, PL-00241 Warsaw, Poland


Join Spatial Econometrics Association conference in June 2022 in Warsaw & ERSA Winterschool in February 2022 in Warsaw https://spatial.wne.uw.edu.pl/

Moje nowe książki i artykuły / My new books & papers:

Kopczewska K., Ćwiakowski P. (2021) Spatio-temporal stability of housing submarkets. Tracking spatial location of clusters of geographically weighted regression estimates of price determinants, Land Use Policy, Volume 103, April 2021, 105292 https://www.sciencedirect.com/science/article/pii/S0264837721000156

red. Kopczewska K. (2020) Przestrzenne metody ilościowe w R: statystyka, ekonometria, uczenie maszynowe, analiza danych, CeDeWu https://cedewu.pl/Przestrzenne-metody-ilosciowe-w-R-statystyka-ekonometria-uczenie-maszynowe-analiza-danych-p2865

ed. Kopczewska K. (2020) Applied Spatial Statistics and Econometrics. Data Analysis in R, Routledge Advanced Texts in Economics and Finance https://www.routledge.com/Applied-Spatial-Statistics-and-Econometrics-Data-Analysis-in-R/Kopczewska/p/book/9780367470760


W dniu 2021-12-27 22:45, Camil88 napisał(a):

Hello, I have faced strange problem when trying to change poviat projection (Chapter 2.1.). I run this code:

pow <- readOGR(dsn = 'C:/Users/mainUser/Desktop/spatial_book-master/powiaty', layer = 'powiaty') pow <- spTransform(pow, CRS('+proj=longlat +datum=NAD83'))

and the following error comes up:

Error in if (is.projected(obj)) { : missing value where TRUE/FALSE needed In addition: Warning message: In spTransform(xSP, CRSobj, ...) : NULL source CRS comment, falling back to PROJ string

I had some initial problems with powiaty files but downloaded updated .zip version from link given in Readme - and I read it to R. However, the error as above shows up.

-- Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. Triage notifications on the go with GitHub Mobile for iOS [3] or Android [4]. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Links:

[1] https://github.com/kkopczewska/spatial_book/issues/2 [2] https://github.com/notifications/unsubscribe-auth/AMU56MC4SLGA5SM6B7PLXLTUTDNBBANCNFSM5K3AKVAQ [3] https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&amp;mt=8&amp;pt=524675 [4] https://play.google.com/store/apps/details?id=com.github.android&amp;referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub