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

Adds export option for layers #1562

Merged
merged 3 commits into from
Jun 17, 2022
Merged

Adds export option for layers #1562

merged 3 commits into from
Jun 17, 2022

Conversation

jokd
Copy link
Contributor

@jokd jokd commented Jun 17, 2022

Fixes #1559

Should be used with caution and works only for vector layers. It exports the features that has been requested from the server, thus works best with geojson-layers or wfs with strategy:all but is primarily intended for draw layers.

Configured like this:

{
"name": "origo-cities",
"title": "Origokommuner",
"group": "root",
"source": "data/origo-cities-3857.geojson",
"style": "origo-logo",
"type": "GEOJSON",
"attributes": [
{
"name": "name"
}
],
"visible": true,
"exportable": true,
"exportFormat": "geojson" // ["geojson", "kml"]
}

exportFormat can be a string (geojson, gpx or kml) or an array of formats. Defaults to geojson in case om omitted or invalid.

@johnnyblasta
Copy link
Collaborator

johnnyblasta commented Jun 17, 2022

It would be nice if exportFormat was case insensitive.

@jokd
Copy link
Contributor Author

jokd commented Jun 17, 2022

Right on Sloppy J

@johnnyblasta
Copy link
Collaborator

Right on Sloppy J

I was mainly thinking of the formats them self to be case insensitive, so you could write geojson or GEOJSON, kml or KML.

@jokd
Copy link
Contributor Author

jokd commented Jun 17, 2022

Have a go again. Now its very forgiving.
Could have done this transform in the export util instead but I put it in the same function as before.

Copy link
Collaborator

@johnnyblasta johnnyblasta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works nicely.
When export to several formats is enabled a eleganter solution could have been implemented other than stacking on the menu, but I approve since probably one format is enhough in most cases.

@jokd jokd merged commit bc97728 into master Jun 17, 2022
@jokd jokd deleted the exportlayer branch June 17, 2022 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export/import of layer
2 participants