/*** Scan the GeoJSON for all the property names and check whether they are valid identifiers** 2017-04-04 Piotr Szrajber <piotr.szrajber@hexagongeospatial.com>*/functionexamineColumnNames(geojson){Object.keys(geojson.features.reduce(function(p,v){Object.keys(v.properties).forEach(function(attributeName){p[attributeName]=1;});returnp;},{})).forEach(function(attributeName){console.log(attributeName+" is "+(/^[$A-Z_][0-9A-Z_$]*$/i.test(attributeName)?"a valid":"an invalid")+" attribute name.");});}// Usage:examineColumnNames(/* your geojson */);
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.