We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
MultiPolygon
Hi, shapes() function doesn't display MultiPolygon using npm leaflet.glify 3.2.0
for the moment i solve it by converting in Polygon only the geojson before
Polygon
const MultiPolygon2PolygonOnly = (geoJ) => { let polyOnly = {type: 'FeatureCollection', features:[]} geoJ.features.forEach((f)=>{ let g = f.geometry if (!g || !g.type) return if (g.type=='Polygon') return polyOnly.features.push(f) if (g.type!='MultiPolygon') return for (let i=0,m=g.coordinates.length;i<m;i++) { polyOnly.features.push({ ...f, geometry: {...g, type: 'Polygon', coordinates: g.coordinates[i]}}) } }) return polyOnly }
sample of geojson that contains Polygon and MultiPolygon
https://raw.githubusercontent.com/gregoiredavid/france-geojson/master/departements-version-simplifiee.geojson
The text was updated successfully, but these errors were encountered:
Nice, that works for me although I had to rewrite it a little:
const MultiPolygon2PolygonOnly = ( geoJ: GeoJSON.FeatureCollection ): GeoJSON.FeatureCollection => { const polyOnly: GeoJSON.FeatureCollection = { type: "FeatureCollection", features: [], }; geoJ.features.forEach((f: GeoJSON.Feature) => { const g = f.geometry; if (!g || !g.type) return; if (g.type == "Polygon") return polyOnly.features.push(f); if (g.type != "MultiPolygon") return; for (let i = 0, m = g.coordinates.length; i < m; i++) { polyOnly.features.push({ ...f, geometry: { ...g, type: "Polygon", coordinates: g.coordinates[i] }, }); } }); return polyOnly; };
Sorry, something went wrong.
No branches or pull requests
Hi,
shapes() function doesn't display
MultiPolygon
using npm leaflet.glify 3.2.0
for the moment i solve it by converting in
Polygon
only the geojson beforesample of geojson that contains
Polygon
andMultiPolygon
https://raw.githubusercontent.com/gregoiredavid/france-geojson/master/departements-version-simplifiee.geojson
The text was updated successfully, but these errors were encountered: