{"id":2043,"library":"geojson","title":"geojson","description":"Python bindings and utilities for GeoJSON. This library provides functions for encoding and decoding GeoJSON formatted data, classes for all GeoJSON Objects as defined by the GeoJSON Format Specification, and implements the Python `__geo_interface__` Specification. It is currently at version 3.2.0 and is actively maintained by the Jazzband community, compatible with Python 3.7 and above.","status":"active","version":"3.2.0","language":"en","source_language":"en","source_url":"https://github.com/jazzband/geojson","tags":["GeoJSON","GIS","mapping","serialization","geospatial"],"install":[{"cmd":"pip install geojson","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"Point","correct":"from geojson import Point"},{"symbol":"LineString","correct":"from geojson import LineString"},{"symbol":"Polygon","correct":"from geojson import Polygon"},{"symbol":"Feature","correct":"from geojson import Feature"},{"symbol":"FeatureCollection","correct":"from geojson import FeatureCollection"},{"symbol":"dumps","correct":"from geojson import dumps"},{"note":"Using `json.loads` directly will return a plain dictionary, losing the GeoJSON object methods and attributes. Use `geojson.loads` for richer objects.","wrong":"import json; json.loads(...)","symbol":"loads","correct":"from geojson import loads"},{"symbol":"dump","correct":"from geojson import dump"},{"note":"Using `json.load` directly will return a plain dictionary, losing the GeoJSON object methods and attributes. Use `geojson.load` for richer objects.","wrong":"import json; json.load(...)","symbol":"load","correct":"from geojson import load"}],"quickstart":{"code":"from geojson import Point, Feature, FeatureCollection, dumps\n\n# Create a Point geometry\npoint = Point((-115.81, 37.24))\n\n# Create a Feature with the Point geometry and properties\nfeature = Feature(geometry=point, properties={\"name\": \"Area 51\"})\n\n# Create a FeatureCollection containing the feature\nfeature_collection = FeatureCollection([feature])\n\n# Serialize the FeatureCollection to a GeoJSON string with indentation\ngeojson_str = dumps(feature_collection, indent=2)\nprint(geojson_str)","lang":"python","description":"This quickstart demonstrates how to create common GeoJSON objects like `Point`, `Feature`, and `FeatureCollection`, and then serialize them into a GeoJSON formatted string using `geojson.dumps`."},"warnings":[{"fix":"Ensure your project uses Python 3.7+ and update any code relying on custom CRS definitions or the `geojson.crs` module.","message":"Version 3.0.0 dropped support for Python 2 and now requires Python 3.7 or newer. Additionally, the `crs` module and related features were removed to strictly conform to the official GeoJSON specification, which mandates WGS84 coordinates.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Replace `json.load(f)` with `geojson.load(f)` and `json.loads(s)` with `geojson.loads(s)`.","message":"When loading or decoding GeoJSON data, always use `geojson.load` or `geojson.loads` instead of the standard `json.load` or `json.loads`. Using the standard `json` module will return plain Python dictionaries, losing the rich GeoJSON object functionality and validation provided by this library.","severity":"gotcha","affected_versions":"All"},{"fix":"Adjust the `precision` attribute when creating GeoJSON objects or set `geojson.DEFAULT_PRECISION` globally if higher precision is required. Be aware that this can increase file size.","message":"GeoJSON object classes in this library apply a default coordinate precision of 6 decimal places (approximately 0.1 meters). While this is often suitable, it may lead to data loss for highly precise geospatial coordinates if not explicitly managed.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}