Whole file

geomet/geomet

The author described this change as esri: Fix geojson to esrijson conversion with custom SRID. It counts as a record because the check below fails on the code as it stood at f4def9688 and passes on 6c8493d80, with nothing else changed between the two runs.

Fix saved2023-11-12
Sharing licenceApache-2.0 · LICENSE
Change size+8 4

What the code was meant to do, written into the code itself as a save note

esri: Fix geojson to esrijson conversion with custom SRID

The change

111111 """
112112 coordkey = "coordinates"
113113 coords = obj[coordkey]
114- srid = _extract_geojson_srid(obj) or srid
114+ if srid is None:
115+ srid = _extract_geojson_srid(obj)
115116 return {"x": coords[0], "y": coords[1], "spatialReference": {"wkid": srid}}
116117
117118
121122
122123 """
123124 coordkey = "coordinates"
124- srid = _extract_geojson_srid(obj) or srid
125+ if srid is None:
126+ srid = _extract_geojson_srid(obj)
125127 return {"points": obj[coordkey], "spatialReference": {"wkid": srid}}
126128
127129
136138 coordinates = [obj[coordkey]]
137139 else:
138140 coordinates = obj[coordkey]
139- srid = _extract_geojson_srid(obj) or srid
141+ if srid is None:
142+ srid = _extract_geojson_srid(obj)
140143 return {"paths": coordinates, "spatialReference": {"wkid": srid}}
141144
142145
157160 else:
158161 for seg in part:
159162 part_list.append([list(coord) for coord in seg])
160- srid = _extract_geojson_srid(data) or srid
163+ if srid is None:
164+ srid = _extract_geojson_srid(data)
161165 return {"rings": part_list, "spatialReference": {"wkid": srid}}
162166
163167

The check that tells the two apart

failpass·geomet/tests/esri_test.py::TestGeoJSONtoEsriJSONCustomSRID::test_dumps_to_esrijson_multipoint_custom_srid

Check file geomet/tests/esri_test.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before itf4def96884c3c5f36fc9be98bc5e351e4aa5a3a6
Broken version dated2023-11-09
Modulegeomet.esri
Units changed_dump_geojson_multipoint, _dump_geojson_point, _dump_geojson_polygon, _dump_geojson_polyline
Fingerprint880df8b1f59a96a3
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.