Open aidanlister opened 3 years ago
This is the difference between this:
And this:
This is happening here: https://github.com/mapbox/mapboxgl-jupyter/blob/9a15a0759db5b0c5dc8d59f4a8e0d77b9c378daf/mapboxgl/viz.py#L281
I'm attempting to solve this by passing in a decimal rather than a float when building my FeatureCollection:
features.append(Feature( geometry=Point((Decimal(m['lng']), Decimal(m['lat']))), ))
You can monkey patch this like this:
import json import decimal class FullJSONEncoder(json.JSONEncoder): def default(self, o): if isinstance(o, decimal.Decimal): return str(o) return super().default(o) default_props = {'cls': FullJSONEncoder, 'skipkeys': False, 'check_circular': False, 'allow_nan': False, 'indent': False, 'separators': None, 'default': None, 'sort_keys': False, 'ensure_ascii': False} with patch.object(json.dumps, '__kwdefaults__', default_props): ...
This is the difference between this:
And this:
This is happening here: https://github.com/mapbox/mapboxgl-jupyter/blob/9a15a0759db5b0c5dc8d59f4a8e0d77b9c378daf/mapboxgl/viz.py#L281
I'm attempting to solve this by passing in a decimal rather than a float when building my FeatureCollection:
You can monkey patch this like this: