jazzband / geojson

Python bindings and utilities for GeoJSON
https://pypi.python.org/pypi/geojson/
BSD 3-Clause "New" or "Revised" License
913 stars 121 forks source link

map_tuples() outputs GeoJSON object with identical properties as input GeoJSON object #216

Closed Stoops-ML closed 11 months ago

Stoops-ML commented 1 year ago

This fixes #136.

Changes applied to utils.map_geometries() and utils.map_tuples():

  1. outputs GeoJSON object instead of dictionary
  2. outputted GeoJSON object has the same properties as inputted GeoJSON object

A test has been added at test_utils.TestMapTuples().

rayrrr commented 11 months ago

Hi @Stoops-ML thanks for this, but my understanding of utils.map_geometries() and utils.map_tuples() is that they are intended to return generic Python objects, not GeoJSON objects. If you look in the docstrings, rtype of map_tuples() is list, for example, not GeoJSON object. I can't think of a clean way to make this suggested change without violating the Chesterton's Fence principle.