{"id":28455084,"url":"https://github.com/riatelab/geoimport","last_synced_at":"2026-03-04T10:02:01.959Z","repository":{"id":289468998,"uuid":"964613411","full_name":"riatelab/geoimport","owner":"riatelab","description":"Easily convert your geospatial data to/from GeoJSON for browser-based applications","archived":false,"fork":false,"pushed_at":"2025-11-19T15:42:45.000Z","size":285,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-24T04:16:47.889Z","etag":null,"topics":["conversion","geojson","geopackage","geospatial","javascript-library","shapefile","typescript-library"],"latest_commit_sha":null,"homepage":"https://riatelab.github.io/geoimport/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/riatelab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-11T13:50:41.000Z","updated_at":"2025-11-19T15:44:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"9a02af3b-e8cf-4b0a-9e3c-ba3ad98f8315","html_url":"https://github.com/riatelab/geoimport","commit_stats":null,"previous_names":["riatelab/geoimport"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/riatelab/geoimport","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riatelab%2Fgeoimport","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riatelab%2Fgeoimport/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riatelab%2Fgeoimport/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riatelab%2Fgeoimport/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/riatelab","download_url":"https://codeload.github.com/riatelab/geoimport/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riatelab%2Fgeoimport/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30078306,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T08:01:56.766Z","status":"ssl_error","status_checked_at":"2026-03-04T08:00:42.919Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["conversion","geojson","geopackage","geospatial","javascript-library","shapefile","typescript-library"],"created_at":"2025-06-06T21:15:11.223Z","updated_at":"2026-03-04T10:02:01.953Z","avatar_url":"https://github.com/riatelab.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# geoimport\n\n\u003ca href=\"https://www.npmjs.com/package/geoimport\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/geoimport\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/geoimport\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/geoimport\" /\u003e\u003c/a\u003e\n\n![](./geoimport-logo.png)\n\nEasily convert your geospatial data to/from GeoJSON for browser-based applications.\n\n## Description\n\nThis library is a high-level wrapper around [gdal3.js](https://github.com/bugra9/gdal3.js) to provide a simple\ninterface for converting geospatial data to and from GeoJSON format.\n\nIt is notably used in the [Magrit](https://github.com/riatelab/magrit) Web-application to handle\nthe import/export of various file formats.\n\n## Overview\n\nThis library provides a simple interface to convert geospatial data to and from GeoJSON format.\nIt is built on top of gdal3.js, which is a WASM port of the GDAL library.\n\nIt exposes the following functions:\n\n- `toGeoJSON`: Converts a supported vector dataset to a GeoJSON FeatureCollection object.\n- `fromGeoJSON`: Converts a GeoJSON FeatureCollection object to one of the supported vector dataset format.\n\n- `toTable`: Converts a supported tabular dataset to a table (array of objects).\n- `fromTable`: Converts a table (array of objects) to a supported tabular dataset format.\n\n- `info`: Returns information about a vector or a tabular dataset, including the number of layers,\n  layer names, geometry type, column names and the coordinate reference system.\n\nSupported geospatial formats include:\n\n- GeoJSON\n- TopoJSON\n- ESRI Shapefile (and zipped Shapefile)\n- Geopackage\n- GML\n- KML\n- GPX\n- FlatGeobuf\n\nSupported tabular formats include:\n\n- CSV\n- ODS\n- XLSX\n\n## Installation\n\nImporting and initializing `geoimport` may vary slightly depending on the context in which\nyou use the library.\n\nYou can install the library using `npm` (or any equivalent package manager):\n\n```bash\nnpm install geoimport\n```\n\nOr you can use it directly in your HTML file by including the following script tag:\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/geoimport@latest/dist/geoimport.min.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\nThe first thing to do is to initialize the library. This is done by calling the `init` function to specify where\nto find the gdal3.js `data` and `wasm` files, and to specify whether to use a web worker or not.\n\nThe `init` function takes an object with the following properties:\n- `path`: The path to the directory containing the gdal3.js files. This is required if the files aren't located in the\n  `./static` directory relative to the `geoimport` JavaScript or if you are using `geoimport` from a CDN.\n  If you prefer to specify each file individually, you can use the `paths` property instead (see below, this can\n  be useful if you are using a bundler like Vite).\n- `paths`: If you are not using the `path` property, an object with the following properties:\n  - `wasm`: The path to the gdal3.js `wasm` file.\n  - `data`: The path to the gdal3.js `data` file.\n  - `js`: The path to the gdal3.js `js` file.\n- `useWorker`: A boolean indicating whether to use a web worker or not. Default is `true` (but if the library detects\n  that the `path` is a CDN, it will set this to `false`\n  because the web worker won't be able to access the files on the CDN).\n\n### Example\n\nIf you imported the library using the script tag (and serving yourself the JS files) you can use it like this,\nwith the default settings:\n\n```js\ngeoimport.init();\n\n// A geojson feature collection\nconst geojson = {\n  type: 'FeatureCollection',\n  features: [\n    {\n      type: 'Feature',\n      geometry: { type: 'Point', coordinates: [1, 1] },\n      properties: { foo: 42 },\n    },\n  ],\n};\n// Convert to shapefile, the result is a zip archive containing all the layers, as a File\nconst resultShp = geoimport.fromGeoJSON(geojson, 'myLayer', 'ESRI Shapefile');\n// Or convert to GeoPackage, using Robinson CRS,\n// the result is a the geopackage file, as a File\nconst resultGpkg = geoimport.fromGeoJSON(\n  geojson,\n  'myLayer',\n  'GPKG',\n  'ESRI:54030',\n);\n\n// Convert back to geojson\nconst resGeojson = geoimport.toGeoJSON(resultGpkg, { layerName: 'myLayer' });\n```\n\nOr if you imported the library from a CDN using the script tag:\n\n```js\ngeoimport.init({\n  path: 'https://cdn.jsdelivr.net/npm/geoimport@latest/dist/static/',\n  useWorker: false,\n});\n\n```\n\nIf you installed the library using `npm` (or another similar package manager) and you are using a bundler like Vite,\nyou can use it like the following  and Vite will take care of bundling the files for you:\n\n```js\nimport { init, toGeoJSON, fromGeoJSON } from 'geoimport';\nimport workerUrl from 'geoimport/dist/static/gdal3.js?url';\nimport dataUrl from 'geoimport/dist/static/gdal3WebAssembly.data?url';\nimport wasmUrl from 'geoimport/dist/static/gdal3WebAssembly.wasm?url';\n\ninit({\n  paths: {\n    wasm: wasmUrl,\n    data: dataUrl,\n    js: workerUrl,\n  },\n  useWorker: true,\n});\n```\n\nSee also this [introduction Notebook on Observable](https://observablehq.com/@mthh/hello-geoimport).\n\nNote that this library depends on [gdal3.js](https://github.com/bugra9/gdal3.js) which is relatively heavy,\nso maybe `geoimport` is not a good fit for you. Indeed, if you only need the conversion from/to GeoJSON and:\n\n- GPX/KML, see [mapbox/togeojson](https://github.com/mapbox/togeojson),\n- Shapefile with CRS support, see [calvinmetcalf/shapefile-js](https://github.com/calvinmetcalf/shapefile-js),\n- GML, see [SKalt/geojson-to-gml-3.2.1](https://github.com/SKalt/geojson-to-gml-3.2.1),\n- FlatGeobuf, see [flatgeobuf/flatgeobuf](https://github.com/flatgeobuf/flatgeobuf),\n- TopoJSON, see [topojson/topojson-client](https://github.com/topojson/topojson-client/) and [topojson/topojson-server](https://github.com/topojson/topojson-server/),\n- GeoPackage, see [ngageoint/geopackage-js](https://github.com/ngageoint/geopackage-js).\n\nHowever, if you need to convert to/from several of these formats (plus XLSX and ODS), this library is for you!\n\n## Contributing\n\nIf you want to contribute to this package, please open an issue or a pull request.\nWe welcome all contributions, including bug fixes, new features, and documentation improvements.\n\nThe package is written in TypeScript and uses the following tools to enforce code quality and a consistent style:\n\n- [Prettier](https://prettier.io/) - Code formatter\n- [ESLint](https://eslint.org/) - Linter\n\nPlease make sure to run these tools (`npm run format` and `npm run lint`) before submitting a pull request.\n\nAlso, note that this project uses [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/)\nand [semantic versioning](https://semver.org/).\n\n## Testing\n\nSince this library is mostly targeting browser environments, the test suite uses [QUnit](https://qunitjs.com/) and runs in the browser.\n\nRun the tests by running `npm run test`, this will open your default browser and run the tests (and since the tests are executed on the built file,\ndon't forget to run `npm run build` after making any change in the code and before running/reloading the tests).\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\nNote that this code imports [gdal3.js](https://github.com/bugra9/gdal3.js) so you must comply with the license of\n[gdal3.js](https://github.com/bugra9/gdal3.js/blob/master/LICENSE)\nwhich is distributed under the [LGPL-2.1 license](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friatelab%2Fgeoimport","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Friatelab%2Fgeoimport","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friatelab%2Fgeoimport/lists"}