-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Invalid index: field name 'x_start' not found #6052
Comments
Hi there, thanks for the report, but could you please use a minimal reproducible example to illustrate the issue? At this point, it is unclear whether the issue is with the data or the plotting. |
My nc data : A tibble: 983 × 2cell geometry ℹ 973 more rowsℹ Use
|
I'm sorry I cannot reproduce the issue from this pasted data. Could you try to isolate the issue with one of the build-in datasets? |
I encounter the same error with the code below. Additional information:
Reproducible example (data is attached):
Session Info Matrix products: default locale: time zone: Europe/Oslo attached base packages: other attached packages: loaded via a namespace (and not attached): |
Thanks @gbiele, I can execute your example and reproduce the reported error. The issue at hand is that we can't seem to compute a graticule for the data (see example). library(ggplot2)
library(sf)
#> Linking to GEOS 3.12.1, GDAL 3.8.4, PROJ 9.3.1; sf_use_s2() is TRUE
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
oslo_geojson = st_read("https://github.com/user-attachments/files/16750144/bydel2020_mednavn.json")
#> Reading layer `sql_statement' from data source
#> `https://github.com/user-attachments/files/16750144/bydel2020_mednavn.json'
#> using driver `GeoJSON'
#> Simple feature collection with 38 features and 2 fields
#> Geometry type: MULTIPOLYGON
#> Dimension: XY
#> Bounding box: xmin: -43954.67 ymin: 6564066 xmax: 285864.4 ymax: 7051059
#> Geodetic CRS: WGS 84
rs = which(grepl("^0301",oslo_geojson$bydelnr))
oslo_geojson$Oslo = 0
oslo_geojson$Oslo[rs] = 1
oslo_geojson %>%
filter(Oslo > 0) %>%
st_graticule()
#> Warning in st_is_longlat(x): bounding box has potentially an invalid value
#> range for longlat data
#> Simple feature collection with 0 features and 3 fields
#> Bounding box: xmin: NA ymin: NA xmax: NA ymax: NA
#> Geodetic CRS: WGS 84
#> [1] degree type degree_label geometry
#> <0 rows> (or 0-length row.names) Created on 2024-08-26 with reprex v2.1.1 |
options(repr.plot.width=10,repr.plot.height=10)
p1 <- ggplot(nc) +
geom_sf(aes(fill=meta[ as.character(nc$cell),'cell_type']))+
theme_void()
p1
I'm trying to find a picture of this.
but
Error: Invalid index: field name 'x_start' not found
The text was updated successfully, but these errors were encountered: