Debian Codegraph @

docs/src/release-notes.md

raw
1
2 # Change Log
3 All notable changes to this project will be documented in this file.
4
5 The format is based on [Keep a Changelog](http://keepachangelog.com/).
6
7 Note: Minor version `0.X.0` update might break the API, It's recommended to pin geojson-pydantic to minor version: `geojson-pydantic>=0.6,<0.7`
8
9 ## [unreleased]
10
11 ## [2.2.0] - 2026-09-21
12
13 * Accept finite floating-point Feature IDs while preserving integer and string IDs. (author @bensynapse, https://github.com/developmentseed/geojson-pydantic/pull/205)
14
15 ## [2.1.2] - 2026-08-24
16
17 * fix: rename `_lines_wtk_coordinates` to `_lines_wkt_coordinates`
18
19 ## [2.1.1] - 2026-04-07
20
21 * fix: Clarify polygon, multipolygon validation error messages (author @psobolewskiPhD, https://github.com/developmentseed/geojson-pydantic/pull/184)
22
23 ## [2.1.0] - 2025-10-08
24
25 * add `.create()` method to Geometry objects to create them without `type` key
26
27 ```python
28 from geojson_pydantic import Point
29
30 Point.create(coordinates=(0,0))
31 >> Point(bbox=None, type='Point', coordinates=Position2D(longitude=0.0, latitude=0.0))
32 ```
33
34 * add python 3.14 support
35
36 ## [2.0.0] - 2025-05-05
37
38 * remove custom `__iter__`, `__getitem__` and `__len__` methods from `GeometryCollection` class **breaking change**
39
40 ```python
41 from geojson_pydantic.geometries import GeometryCollection, Point, MultiPoint
42
43 geoms = GeometryCollection(
44 type="GeometryCollection",
45 geometries=[
46 Point(type="Point", coordinates=(102.0, 0.5)),
47 MultiPoint(type="MultiPoint", coordinates=[(100.0, 0.0), (101.0, 1.0)]),
48 ],
49 )
50
51 ########
52 # Before
53 for geom in geom: # __iter__
54 pass
55
56 assert len(geoms) == 2 # __len__
57
58 _ = geoms[0] # __getitem__
59
60 #####
61 # Now
62 for geom in geom.iter(): # __iter__
63 pass
64
65 assert geoms.length == 2 # __len__
66
67 _ = geoms.geometries[0] # __getitem__
68 ```
69
70 * remove custom `__iter__`, `__getitem__` and `__len__` methods from `FeatureCollection` class **breaking change**
71
72 ```python
73 from geojson_pydantic import FeatureCollection, Feature, Point
74
75 fc = FeatureCollection(
76 type="FeatureCollection",
77 features=[
78 Feature(
79 type="Feature",
80 geometry=Point(type="Point", coordinates=(102.0, 0.5)),
81 properties={"name": "point1"},
82 ),
83 Feature(
84 type="Feature",
85 geometry=Point(type="Point", coordinates=(102.0, 1.5)),
86 properties={"name": "point2"},
87 ),
88 ],
89 )
90
91 ########
92 # Before
93 for feat in fc: # __iter__
94 pass
95
96 assert len(fc) == 2 # __len__
97
98 _ = fc[0] # __getitem__
99
100 #####
101 # Now
102 for feat in fc.iter(): # __iter__
103 pass
104
105 assert fc.length == 2 # __len__
106
107 _ = fe.features[0] # __getitem__
108 ```
109
110 * make sure `GeometryCollection` are homogeneous for Z coordinates
111
112 ```python
113 from geojson_pydantic.geometries import Point, LineString, GeometryCollection
114 # Before
115 GeometryCollection(
116 type="GeometryCollection",
117 geometries=[
118 Point(type="Point", coordinates=[0, 0]), # 2D point
119 LineString(
120 type="LineString", coordinates=[(0.0, 0.0, 0.0), (1.0, 1.0, 1.0)] # 3D LineString
121 ),
122 ],
123 )
124 >>> GeometryCollection(bbox=None, type='GeometryCollection', geometries=[Point(bbox=None, type='Point', coordinates=Position3D(longitude=0.0, latitude=0.0, altitude=0.0)), LineString(bbox=None, type='LineString', coordinates=[Position3D(longitude=0.0, latitude=0.0, altitude=0.0), Position3D(longitude=1.0, latitude=1.0, altitude=1.0)])])
125
126 # Now
127 GeometryCollection(
128 type="GeometryCollection",
129 geometries=[
130 Point(type="Point", coordinates=[0, 0]), # 2D point
131 LineString(
132 type="LineString", coordinates=[(0.0, 0.0, 0.0), (1.0, 1.0, 1.0)] # 3D LineString
133 ),
134 ],
135 )
136 >>> ValidationError: 1 validation error for GeometryCollection
137 geometries
138 Value error, GeometryCollection cannot have mixed Z dimensionality. [type=value_error, input_value=[Point(bbox=None, type='P...de=1.0, altitude=1.0)])], input_type=list]
139 For further information visit https://errors.pydantic.dev/2.11/v/value_error
140 ```
141
142 ## [1.2.0] - 2024-12-19
143
144 * drop python 3.8 support
145 * add python 3.13 support
146
147 ## [1.1.2] - 2024-10-22
148
149 * relax `bbox` validation and allow antimeridian crossing bboxes
150
151 ## [1.1.1] - 2024-08-29
152
153 * add python 3.12 support
154 * switch to `flit-core` for packaging build backend
155
156 ## [1.1.0] - 2024-05-10
157
158 ### Added
159
160 * Add Position2D and Position3D of type NamedTuple (author @impocode, https://github.com/developmentseed/geojson-pydantic/pull/161)
161
162 ## [1.0.2] - 2024-01-16
163
164 ### Fixed
165
166 * Temporary workaround for surfacing model attributes in FastAPI application (author @markus-work, https://github.com/developmentseed/geojson-pydantic/pull/153)
167
168 ## [1.0.1] - 2023-10-04
169
170 ### Fixed
171
172 * Model serialization when using include/exclude (ref: https://github.com/developmentseed/geojson-pydantic/pull/148)
173
174 ## [1.0.0] - 2023-07-24
175
176 ### Fixed
177
178 * reduce validation error message verbosity when discriminating Geometry types
179 * MultiPoint WKT now includes parentheses around each Point
180
181 ### Added
182
183 * more tests for `GeometryCollection` warnings
184
185 ### Changed
186
187 * update pydantic requirement to `~=2.0`
188
189 * update pydantic `FeatureCollection` generic model to allow named features in the generated schemas.
190
191 ```python
192 # before
193 FeatureCollection[Geometry, Properties]
194
195 # now
196 FeatureCollection[Feature[Geometry, Properties]]
197 ```
198
199 * raise `ValueError` in `geometries.parse_geometry_obj` instead of `ValidationError`
200
201 ```python
202 # before
203 parse_geometry_obj({"type": "This type", "obviously": "doesn't exist"})
204 >> ValidationError
205
206 # now
207 parse_geometry_obj({"type": "This type", "obviously": "doesn't exist"})
208 >> ValueError("Unknown type: This type")
209 ```
210
211 * update JSON serializer to exclude null `bbox` and `id`
212
213 ```python
214 # before
215 Point(type="Point", coordinates=[0, 0]).json()
216 >> '{"type":"Point","coordinates":[0.0,0.0],"bbox":null}'
217
218 # now
219 Point(type="Point", coordinates=[0, 0]).model_dump_json()
220 >> '{"type":"Point","coordinates":[0.0,0.0]}'
221 ```
222
223 * delete `geojson_pydantic.geo_interface.GeoInterfaceMixin` and replaced by `geojson_pydantic.base._GeoJsonBase` class
224
225 * delete `geojson_pydantic.types.validate_bbox`
226
227 ## [0.6.3] - 2023-07-02
228
229 * limit pydantic requirement to `~=1.0`
230
231 ## [0.6.2] - 2023-05-16
232
233 ### Added
234
235 * Additional bbox validation (author @eseglem, https://github.com/developmentseed/geojson-pydantic/pull/122)
236
237 ## [0.6.1] - 2023-05-12
238
239 ### Fixed
240
241 * Fix issue with null bbox validation (author @bmschmidt, https://github.com/developmentseed/geojson-pydantic/pull/119)
242
243 ## [0.6.0] - 2023-05-09
244
245 No change since 0.6.0a0
246
247 ## [0.6.0a0] - 2023-04-04
248
249 ### Added
250
251 - Validate order of bounding box values. (author @moradology, https://github.com/developmentseed/geojson-pydantic/pull/114)
252 - Enforce required keys and avoid defaults. This aim to follow the geojson specification to the letter.
253
254 ```python
255 # Before
256 Feature(geometry=Point(coordinates=(0, 0)))
257
258 # Now
259 Feature(
260 type="Feature",
261 geometry=Point(type="Point", coordinates=(0, 0)),
262 properties=None,
263 )
264 ```
265
266 - Add has_z function to Geometries (author @eseglem, https://github.com/developmentseed/geojson-pydantic/pull/103)
267 - Add optional bbox to geometries. (author @eseglem, https://github.com/developmentseed/geojson-pydantic/pull/108)
268 - Add support for nested GeometryCollection and a corresponding warning. (author @eseglem, https://github.com/developmentseed/geojson-pydantic/pull/111)
269
270 ### Changed
271
272 - Refactor and simplify WKT construction (author @eseglem, https://github.com/developmentseed/geojson-pydantic/pull/97)
273 - Support empty geometry coordinates (author @eseglem, https://github.com/developmentseed/geojson-pydantic/pull/100)
274 - Refactored `__geo_interface__` to be a Mixin which returns `self.dict` (author @eseglem, https://github.com/developmentseed/geojson-pydantic/pull/105)
275 - GeometryCollection containing a single geometry or geometries of only one type will now produce a warning. (author @eseglem, https://github.com/developmentseed/geojson-pydantic/pull/111)
276
277 ### Fixed
278
279 - Do not validates arbitrary dictionaries. Make `Type` a mandatory key for objects (author @vincentsarago, https://github.com/developmentseed/geojson-pydantic/pull/94)
280 - Add Geometry discriminator when parsing geometry objects (author @eseglem, https://github.com/developmentseed/geojson-pydantic/pull/101)
281 - Mixed Dimensionality WKTs (make sure the coordinates are either all 2D or 3D) (author @eseglem, https://github.com/developmentseed/geojson-pydantic/pull/107)
282 - Allow Feature's **id** to be either a String or a Number (author @vincentsarago, https://github.com/developmentseed/geojson-pydantic/pull/91)
283
284 ### Removed
285
286 - Python 3.7 support (author @vincentsarago, https://github.com/developmentseed/geojson-pydantic/pull/94)
287 - Unused `LinearRing` Model (author @eseglem, https://github.com/developmentseed/geojson-pydantic/pull/106)
288
289 ## [0.5.0] - 2022-12-16
290
291 ### Added
292
293 - python 3.11 support
294
295 ### Fixed
296
297 - Derive WKT type from Geometry's type instead of class name (author @eseglem, https://github.com/developmentseed/geojson-pydantic/pull/81)
298
299 ### Changed
300
301 - Replace `NumType` with `float` throughout (author @eseglem, https://github.com/developmentseed/geojson-pydantic/pull/83)
302 - `__geo_interface__` definition to not use pydantic `BaseModel.dict()` method and better match the specification
303 - Adjusted mypy configuration and updated type definitions to satisfy all rules (author @eseglem, https://github.com/developmentseed/geojson-pydantic/pull/87)
304 - Updated pre-commit config to run mypy on the whole library instead of individual changed files.
305 - Defaults are more explicit. This keeps pyright from thinking they are required.
306
307 ### Removed
308
309 - Remove `validate` classmethods used to implicitly load json strings (author @eseglem, https://github.com/developmentseed/geojson-pydantic/pull/88)
310
311 ## [0.4.3] - 2022-07-18
312
313 ### Fixed
314
315 - The bbox key should not be in a `__geo_interface__` object if the bbox is None (author @yellowcap, https://github.com/developmentseed/geojson-pydantic/pull/77)
316
317 ## [0.4.2] - 2022-06-13
318
319 ### Added
320
321 - `GeometryCollection` as optional input to geometry field in `Feature` (author @davidraleigh, https://github.com/developmentseed/geojson-pydantic/pull/72)
322
323 ## [0.4.1] - 2022-06-10
324
325 ### Added
326
327 - `Geometry` and `GeometryCollection` validation from dict or string (author @Vikka, https://github.com/developmentseed/geojson-pydantic/pull/69)
328
329 ```python
330 Point.validate('{"coordinates": [1.0, 2.0], "type": "Point"}')
331 >> Point(coordinates=(1.0, 2.0), type='Point')
332 ```
333
334 - `Feature` and `FeatureCollection` validation from dict or string
335
336 ```python
337 FeatureCollection.validate('{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"coordinates": [1.0, 2.0], "type": "Point"}}]}')
338 >> FeatureCollection(type='FeatureCollection', features=[Feature(type='Feature', geometry=Point(coordinates=(1.0, 2.0), type='Point'), properties=None, id=None, bbox=None)], bbox=None)
339 ```
340
341 ## [0.4.0] - 2022-06-03
342
343 ### Added
344 - `.wkt` property for Geometry object
345 ```python
346 from geojson_pydantic.geometries import Point
347
348 Point(coordinates=(1, 2)).wkt
349 >> 'POINT (1.0 2.0)'
350 ```
351
352 - `.exterior` and `.interiors` properties for `geojson_pydantic.geometries.Polygon` object.
353 ```python
354 from geojson_pydantic.geometries import Polygon
355 polygon = Polygon(
356 coordinates=[
357 [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)],
358 [(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)],
359 ]
360 )
361 polygon.exterior
362 >> [(0.0, 0.0), (0.0, 10.0), (10.0, 10.0), (10.0, 0.0), (0.0, 0.0)]
363
364 list(polygon.interiors)
365 >> [[(2.0, 2.0), (2.0, 4.0), (4.0, 4.0), (4.0, 2.0), (2.0, 2.0)]]
366 ```
367
368 - `__geo_interface__` to `geojson_pydantic.geometries.GeometryCollection` object
369 - `__geo_interface__` to `geojson_pydantic.feature.Feature` and `geojson_pydantic.feature.FeatureCollection` object
370 - `geojson_pydantic.__all__` to declaring public objects (author @farridav, https://github.com/developmentseed/geojson-pydantic/pull/52)
371
372 ### Changed
373 - switch to `pyproject.toml`
374 - rename `geojson_pydantic.version` to `geojson_pydantic.__version__`
375
376 ### Fixed
377 - changelog compare links
378
379 ## [0.3.4] - 2022-04-28
380
381 - Fix optional geometry and bbox fields on `Feature`; allowing users to pass in `None` or even omit either field (author @moradology, https://github.com/developmentseed/geojson-pydantic/pull/56)
382 - Fix `Polygon.from_bounds` to respect geojson specification and return counterclockwise linear ring (author @jmfee-usgs, https://github.com/developmentseed/geojson-pydantic/pull/49)
383
384 ## [0.3.3] - 2022-03-04
385
386 - Follow geojson specification and make feature geometry optional (author @yellowcap, https://github.com/developmentseed/geojson-pydantic/pull/47)
387 ```python
388 from geojson_pydantic import Feature
389 # Before
390 feature = Feature(type="Feature", geometry=None, properties={})
391
392 >> ValidationError: 1 validation error for Feature
393 geometry none is not an allowed value (type=type_error.none.not_allowed)
394
395 # Now
396 feature = Feature(type="Feature", geometry=None, properties={})
397 assert feature.geometry is None
398 ```
399
400 ## [0.3.2] - 2022-02-21
401
402 - fix `parse_geometry_obj` potential bug (author @geospatial-jeff, https://github.com/developmentseed/geojson-pydantic/pull/45)
403 - improve type definition (and validation) for geometry coordinate arrays (author @geospatial-jeff, https://github.com/developmentseed/geojson-pydantic/pull/44)
404
405 ## [0.3.1] - 2021-08-04
406
407 ### Added
408 - `Polygon.from_bounds` class method to create a Polygon geometry from a bounding box.
409 ```python
410 from geojson_pydantic import Polygon
411 print(Polygon.from_bounds((1, 2, 3, 4)).dict(exclude_none=True))
412 >> {'coordinates': [[(1.0, 2.0), (1.0, 4.0), (3.0, 4.0), (3.0, 2.0), (1.0, 2.0)]], 'type': 'Polygon'}
413 ```
414
415 ### Fixed
416 - Added validation for Polygons with zero size.
417
418
419 ## [0.3.0] - 2021-05-25
420
421 ### Added
422 - `Feature` and `FeatureCollection` model generics to support custom geometry and/or properties validation (author @iwpnd, https://github.com/developmentseed/geojson-pydantic/pull/29)
423
424 ```python
425 from pydantic import BaseModel
426 from geojson_pydantic.features import Feature
427 from geojson_pydantic.geometries import Polygon
428
429
430 class MyFeatureProperties(BaseModel):
431 name: str
432 value: int
433
434
435 feature = Feature[Polygon, MyFeatureProperties](
436 **{
437 "type": "Feature",
438 "geometry": {
439 "type": "Polygon",
440 "coordinates": [
441 [
442 [13.38272, 52.46385],
443 [13.42786, 52.46385],
444 [13.42786, 52.48445],
445 [13.38272, 52.48445],
446 [13.38272, 52.46385],
447 ]
448 ],
449 },
450 "properties": {"name": "test", "value": 1},
451 }
452 )
453 ```
454
455 - Top level export (https://github.com/developmentseed/geojson-pydantic/pull/34)
456
457 ```python
458 # before
459 from geojson_pydantic.features import Feature, FeatureCollection
460 from geojson_pydantic.geometries import Polygon
461
462 # now
463 from geojson_pydantic import Feature, Polygon
464 ```
465
466 ### Removed
467 - Drop python 3.6 support
468 - Renamed `utils.py` to `types.py`
469 - Removed `Coordinate` type in `geojson_pydantic.features` (replaced by `Position`)
470
471 ## [0.2.3] - 2021-05-05
472
473 ### Fixed
474 - incorrect version number set in `__init__.py`
475
476 ## [0.2.2] - 2020-12-29
477
478 ### Added
479 - Made collections iterable (#12)
480 - Added `parse_geometry_obj` function (#9)
481
482 ## [0.2.1] - 2020-08-07
483
484 Although the type file was added in `0.2.0` it wasn't included in the distributed package. Use this version `0.2.1` for type annotations.
485
486 ### Fixed
487 - Correct package type information files
488
489 ## [0.2.0] - 2020-08-06
490
491 ### Added
492 - Added documentation on locally running tests (#3)
493 - Publish type information (#6)
494
495 ### Changed
496 - Removed geojson dependency (#4)
497
498 ### Fixed
499 - Include MultiPoint as a valid geometry for a Feature (#1)
500
501 ## [0.1.0] - 2020-05-21
502
503 ### Added
504 - Initial Release
505
506 [unreleased]: https://github.com/developmentseed/geojson-pydantic/compare/2.2.0...HEAD
507 [2.2.0]: https://github.com/developmentseed/geojson-pydantic/compare/2.1.2...2.2.0
508 [2.1.2]: https://github.com/developmentseed/geojson-pydantic/compare/2.1.1...2.1.2
509 [2.1.1]: https://github.com/developmentseed/geojson-pydantic/compare/2.1.0...2.1.1
510 [2.1.0]: https://github.com/developmentseed/geojson-pydantic/compare/2.0.0...2.1.0
511 [2.0.0]: https://github.com/developmentseed/geojson-pydantic/compare/1.2.0...2.0.0
512 [1.2.0]: https://github.com/developmentseed/geojson-pydantic/compare/1.1.2...1.2.0
513 [1.1.2]: https://github.com/developmentseed/geojson-pydantic/compare/1.1.1...1.1.2
514 [1.1.1]: https://github.com/developmentseed/geojson-pydantic/compare/1.1.0...1.1.1
515 [1.1.0]: https://github.com/developmentseed/geojson-pydantic/compare/1.0.2...1.1.0
516 [1.0.2]: https://github.com/developmentseed/geojson-pydantic/compare/1.0.1...1.0.2
517 [1.0.1]: https://github.com/developmentseed/geojson-pydantic/compare/1.0.0...1.0.1
518 [1.0.0]: https://github.com/developmentseed/geojson-pydantic/compare/0.6.3...1.0.0
519 [0.6.3]: https://github.com/developmentseed/geojson-pydantic/compare/0.6.2...0.6.3
520 [0.6.2]: https://github.com/developmentseed/geojson-pydantic/compare/0.6.1...0.6.2
521 [0.6.1]: https://github.com/developmentseed/geojson-pydantic/compare/0.6.0...0.6.1
522 [0.6.0]: https://github.com/developmentseed/geojson-pydantic/compare/0.6.0a0...0.6.0
523 [0.6.0a]: https://github.com/developmentseed/geojson-pydantic/compare/0.5.0...0.6.0a0
524 [0.5.0]: https://github.com/developmentseed/geojson-pydantic/compare/0.4.3...0.5.0
525 [0.4.3]: https://github.com/developmentseed/geojson-pydantic/compare/0.4.2...0.4.3
526 [0.4.2]: https://github.com/developmentseed/geojson-pydantic/compare/0.4.1...0.4.2
527 [0.4.1]: https://github.com/developmentseed/geojson-pydantic/compare/0.4.0...0.4.1
528 [0.4.0]: https://github.com/developmentseed/geojson-pydantic/compare/0.3.4...0.4.0
529 [0.3.4]: https://github.com/developmentseed/geojson-pydantic/compare/0.3.3...0.3.4
530 [0.3.3]: https://github.com/developmentseed/geojson-pydantic/compare/0.3.2...0.3.3
531 [0.3.2]: https://github.com/developmentseed/geojson-pydantic/compare/0.3.1...0.3.2
532 [0.3.1]: https://github.com/developmentseed/geojson-pydantic/compare/0.3.0...0.3.1
533 [0.3.0]: https://github.com/developmentseed/geojson-pydantic/compare/0.2.3...0.3.0
534 [0.2.3]: https://github.com/developmentseed/geojson-pydantic/compare/0.2.2...0.2.3
535 [0.2.2]: https://github.com/developmentseed/geojson-pydantic/compare/0.2.1...0.2.2
536 [0.2.1]: https://github.com/developmentseed/geojson-pydantic/compare/0.2.0...0.2.1
537 [0.2.0]: https://github.com/developmentseed/geojson-pydantic/compare/0.1.0...0.2.0
538 [0.1.0]: https://github.com/developmentseed/geojson-pydantic/compare/005f3e57ad07272c99c54302decc63eec12175c9...0.1.0