Repository navigation
New module: geo.js
geo.js (new) - read GeoJSON from a URL or a local file.
getGeoJSON(url, responseFunction, tokenkey?, tokenvalue?)followsgetJSON's{ status, data }callback, but sends no headers unless a token is given, so static hosts like raw.githubusercontent.com work without a CORS preflight. GitHub file-page links are rewritten to their raw URL.readGeoJSONFile(id, responseFunction)reads an<input type="file">;parseGeoJSON(input)validates a string or object.- Any input - FeatureCollection, Feature, bare geometry or an array - comes out as a FeatureCollection whose features always have
properties. Invalid features are skipped and logged instead of failing the whole file. getBBox,getCenter,getPropertyKeys,getCoordinatesandtoLatLngfor summarising data and feeding a map or table.