Debian Codegraph @

docs/src/release-notes.md

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