Skip to content
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

data dump to GeoParquet or FlatGeobuf format for optimization requests #58

Closed
ABiatov opened this issue Oct 28, 2023 · 2 comments
Closed
Assignees
Labels
enhancement New feature or request

Comments

@ABiatov
Copy link
Owner

ABiatov commented Oct 28, 2023

Попробовать заменить формат дампа данных на GeoParquet или FlatGeobuf для того чтоб когда отправляем запрос "Получить данные" не скачивался весь дамп а только его часть.

В R есть библиотеки для работы с GeoParquet : geoarrow и sfarrow

FlatGeobuf можно читать при помощи sf

@ABiatov ABiatov added the enhancement New feature or request label Oct 28, 2023
@ABiatov ABiatov self-assigned this Oct 28, 2023
@ABiatov
Copy link
Owner Author

ABiatov commented Nov 12, 2023

Work with flatgeobuf (.fgb) in R

"fgb" = "FlatGeobuf"

Read flatgeobuf (.fgb) with SF in R

library(sf)

geobuf_url <- "https://esa-worldcover.s3.eu-central-1.amazonaws.com/esa_worldcover_grid_composites.fgb"

wkt <- "POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10),
(20 30, 35 35, 30 20, 20 30))"

data <- read_sf(geobuf_url)

data_filtred <- read_sf(geobuf_url, 
                        wkt_filter = wkt)

plot(data$geometry, col="blue")
plot(data_filtred$geometry, col="red", add = T)

Write flatgeobuf (.fgb) with SF in R

write_sf(data_filtred, 
         dsn="C:/Temp/my_data.fgb",
         driver="FlatGeobuf",
         delete_dsn= TRUE)  # overwrite file

# or

st_write(data_filtred, "C:/Temp/my_data.fgb", delete_dsn= TRUE)

@ABiatov
Copy link
Owner Author

ABiatov commented Dec 6, 2023

разделил на подзадачи:

Read FlatGeobuf datadup:

#73

Write datadump to FlatGeobuf

#74

@ABiatov ABiatov closed this as completed Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant