{"id":13508058,"url":"https://github.com/benbalter/geojson-diff","last_synced_at":"2025-09-27T21:31:52.189Z","repository":{"id":16206815,"uuid":"18953691","full_name":"benbalter/geojson-diff","owner":"benbalter","description":"A Ruby library for diffing GeoJSON files","archived":false,"fork":false,"pushed_at":"2015-08-22T21:01:16.000Z","size":354,"stargazers_count":101,"open_issues_count":0,"forks_count":5,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-08-18T10:09:40.219Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/benbalter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-19T23:56:26.000Z","updated_at":"2025-05-08T03:51:14.000Z","dependencies_parsed_at":"2022-08-24T19:40:29.875Z","dependency_job_id":null,"html_url":"https://github.com/benbalter/geojson-diff","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/benbalter/geojson-diff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benbalter%2Fgeojson-diff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benbalter%2Fgeojson-diff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benbalter%2Fgeojson-diff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benbalter%2Fgeojson-diff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benbalter","download_url":"https://codeload.github.com/benbalter/geojson-diff/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benbalter%2Fgeojson-diff/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276968415,"owners_count":25737257,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-25T02:00:09.612Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-08-01T02:00:47.073Z","updated_at":"2025-09-27T21:31:51.912Z","avatar_url":"https://github.com/benbalter.png","language":"Ruby","readme":"# GeoJSON Diff\n\n*A Ruby library for diffing GeoJSON files*\n\n[![Gem Version](https://badge.fury.io/rb/geojson-diff.svg)](http://badge.fury.io/rb/geojson-diff) [![Build Status](https://travis-ci.org/benbalter/geojson-diff.svg?branch=master)](https://travis-ci.org/benbalter/geojson-diff)\n\n## Overview\n\nGeoJSON Diff takes two GeoJSON files representing the same geometry (or geometries) at two points in time, and generates three GeoJSON files representing the `added`, `removed`, and `unchanged` geometries (including changed properties).\n\nThese three GeoJSON files can be used to generate a visual representation of the changes (proposed or realized), e.g., by coloring the added elements green and the removed elements red. GeoJSON Diff is what powers [GeoJSON diffing on GitHub](https://github.com/blog/1772-diffable-more-customizable-maps).\n\n### GeoJSON Diff in the wild\n\nSee GeoJSON diff in action! Here's [a diff of Illinois's famed 4th congressional district](https://github.com/benbalter/congressional-districts/commit/2233c76ca5bb059582d796f053775d8859198ec5) after undergoing redistricting in 2011:\n\n[![Illinois 4th Congressional district](https://f.cloud.github.com/assets/282759/2090660/63f2e45a-8e97-11e3-9d8b-d4c8078b004e.gif)](https://github.com/benbalter/congressional-districts/commit/2233c76ca5bb059582d796f053775d8859198ec5#diff-85d2c1b78193e963475250414e57940b)\n\nGeoJSON Diff will even diff properties within the geometry when they change:\n\n[![Updating a property](https://f.cloud.github.com/assets/282759/2022569/dfaf96b8-884f-11e3-95ca-8f54c60a2ccf.png)](https://github.com/DU-GIS/Geojson_Data/commit/042e86e417a7fb9e43504640046339e82618e4c2#diff-0cca6b7c0e294c8d3e9d9b8090ab9e24)\n\n## Usage\n\n```ruby\ndiff = GeojsonDiff.new geojson_before, geojson_after\n\ndiff.added\n# =\u003e {\"type\":\"Feature\"... (valid GeoJSON representing the added geometries)\n\ndiff.removed\n# =\u003e {\"type\":\"Feature\"... (valid GeoJSON representing the removed geometries)\n\ndiff.unchanged\n# =\u003e {\"type\":\"Feature\"... (valid GeoJSON representing the unchanged geometries)\n```\n\nFor practical examples, take a look at the [test/fixtures directory](test/fixtures).\n\n## Displaying the resulting GeoJSON\n\nEvery geometry within the resulting GeoJSON files will be appended with standard GeoJSON properties in the `_geojson_diff` namespace.\n\n* `type` - this field contains either `added`, `removed`, or `unchanged` and describes the state of the geometry as it relates to the initial GeoJSON file.\n* `added`, `removed`, `changed` - these fields contain an array of property keys. If a given key is in the `added` array, that property existed in the resulting geometry, but not in the initial geometry. Likewise, if a key is in `removed` array it existed in the initial geometry, but not the resulting geometry, and if the key is in the `changed` array, it existed in both the initial and resulting geometry, but was changed.\n* For changed properties, the values of the `after` GeoJSON file will be marked up as a [Diffy `:html` diff](https://github.com/samg/diffy#html-output) and will represent the inline diff of the changed value.\n\n## Installation\n\n### Requirements\n\nGeoJSON Diff is based on [rgeo](https://github.com/dazuma/rgeo), [rgeo-geojson](https://github.com/dazuma/rgeo-geojson), [geos](http://trac.osgeo.org/geos/), [ffi-geos](https://github.com/dark-panda/ffi-geos), and [diffy](https://github.com/samg/diffy).\n\n### Installing GEOS\n\nIf you're on OS X and have Homebrew installed, you'll first want to run `brew install geos` to install the GEOS geospatial library. On other systems, consult [the GEOS installation instructions](http://trac.osgeo.org/geos/).\n\n### Installing the Gem\n\nAdd the following to your project's Gemfile and run `bundle install`:\n\n`gem 'geojson-diff'`\n\n### Pro-Tip\n\nBecause the library depends on [GEOS](http://trac.osgeo.org/geos/), which can be finicky on some systems, the set-it-and-forget-it way to get everything set up is to:\n\n1. Add `gem 'geojson-diff'` to your project's Gemfile\n2. Copy the contents of [script/bootstrap](script/bootstrap)\n3. `cd` to your project's root directory and paste/run the commands\n\nThis will install GEOS and configure the necessary environmental values.\n\n## Development\n\n### Bootstrapping a local development environment\n\n`script/bootstrap`\n\n### Running tests\n\n`script/cibuild`\n\n### Development console\n\n`script/console`\n\n## Troubleshooting GEOS\n\nOn some environments, prior to running your application or running `bundle install`, you'll need to run the following commands to properly configure your execution environment for Ruby to find the GEOS library:\n\n```\nexport GEOS_LIBRARY_PATH=`geos-config --prefix`/lib\nbundle config --local build.rgeo --with-geos-dir=\"$GEOS_LIBRARY_PATH\"\n````\n\n## License\n\n[MIT](LICENSE.md)\n\n## Contributing\n\n1. Fork the project\n2. Create a descriptively named feature branch\n3. Make your changes\n4. Submit a pull request\n","funding_links":[],"categories":["visualizing diffs of data:"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenbalter%2Fgeojson-diff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenbalter%2Fgeojson-diff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenbalter%2Fgeojson-diff/lists"}