SymbolixAU / geojsonsf

Conversion between sf and geojson
Other
82 stars 7 forks source link

Date column not handled properly #46

Closed layik closed 6 years ago

layik commented 6 years ago

Hey guys, very similar issue to the one I reported before but I think its better to be in a new ticket.

gjio <- geojsonio::geojson_json(geoplumber::traffic_casualties_2014[1:2,])
gjsf <- geojsonsf::sf_geojson(geoplumber::traffic_casualties_2014[1:2,])
print(gjio)
#> <FeatureCollection> 
#>   type:  FeatureCollection 
#>   no. features:  2 
#>   features (1st 5):  Point, Point
print(gjsf)
#> [1] "{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{\"Accident_Severity\":\"Slight\",\"Date\":2014-05-18},\"geometry\":{\"type\":\"Point\",\"coordinates\":[-0.088153,51.506886]}},{\"type\":\"Feature\",\"properties\":{\"Accident_Severity\":\"Slight\",\"Date\":2014-09-15},\"geometry\":{\"type\":\"Point\",\"coordinates\":[-0.077685,51.502218]}}]}"

Created on 2018-10-16 by the reprex package (v0.2.0).

layik commented 6 years ago

https://github.com/ATFutures/geoplumber/issues/52

SymbolixAU commented 6 years ago

I see a different result

print(gjsf)
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"Accident_Severity":3,"Date":"2014-05-18"},"geometry":{"type":"Point","coordinates":[-0.088153,51.506886]}},{"type":"Feature","properties":{"Accident_Severity":3,"Date":"2014-09-15"},"geometry":{"type":"Point","coordinates":[-0.077685,51.502218]}}]
devtools::session_info("geojsonsf")
Session info --------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.5.0 (2018-04-23)
 system   x86_64, darwin15.6.0        
 ui       RStudio (1.2.637)           
 language (EN)                        
 collate  en_AU.UTF-8                 
 tz       Australia/Melbourne         
 date     2018-10-16                  

Packages ------------------------------------------------------------------------------------------------------------------
 package    * version date       source         
 curl         3.2     2018-03-28 CRAN (R 3.5.0) 
 geojsonsf  * 1.2     2018-10-16 local          
 graphics   * 3.5.0   2018-04-24 local          
 grDevices  * 3.5.0   2018-04-24 local          
 jsonify      0.1.1   2018-10-10 local          
 methods    * 3.5.0   2018-04-24 local          
 rapidjsonr   1.1     2018-09-22 local          
 Rcpp         0.12.19 2018-10-01 cran (@0.12.19)
 stats      * 3.5.0   2018-04-24 local          
 utils      * 3.5.0   2018-04-24 local 
SymbolixAU commented 6 years ago

@layik can you confirm the version of geojsonsf you're using?

layik commented 6 years ago

Still on ‘1.1’

SymbolixAU commented 6 years ago

ok, I think if you update to 1.2 you'll see the change

devtools::install_github("SymbolixAU/geojsonsf")
layik commented 6 years ago

I might have to change the data, as I want to keep Travis pulling from CRAN.

layik commented 6 years ago

Thanks guys.

devtools::session_info("geojsonsf")
#> Session info -------------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.4.4 (2018-03-15)
#>  system   x86_64, linux-gnu           
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_GB.UTF-8                 
#>  tz       Europe/London               
#>  date     2018-10-16
#> Packages -----------------------------------------------------------------
#>  package    * version date       source        
#>  curl         3.2     2018-03-28 CRAN (R 3.4.4)
#>  geojsonsf    1.1     2018-06-29 CRAN (R 3.4.4)
#>  graphics   * 3.4.4   2018-04-21 local         
#>  grDevices  * 3.4.4   2018-04-21 local         
#>  methods    * 3.4.4   2018-04-21 local         
#>  rapidjsonr   1.0.0   2018-04-10 CRAN (R 3.4.4)
#>  Rcpp         0.12.18 2018-07-23 CRAN (R 3.4.4)
#>  stats      * 3.4.4   2018-04-21 local         
#>  utils      * 3.4.4   2018-04-21 local

Created on 2018-10-16 by the reprex package (v0.2.0).