Skip to content

[Question] How to get the geojson of all features added by Leaflet-geoman #856

Discussion options

You must be logged in to vote

You can get all layers from the map and check if they have the pm property and not temporary layers.

function generateGeoJson(){
	var fg = map.pm.getGeomanDrawLayers(true); // or getGeomanLayers() <-- "true" make that it returns a FeatureGroup instead of an array
	console.log(fg.toGeoJSON());
}

Demo: https://jsfiddle.net/falkedesign/054go8j2/

Replies: 6 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by Falke-Design
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@Falke-Design
Comment options

@designcomputer
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #605 on April 14, 2021 20:20.