django-geostore icon indicating copy to clipboard operation
django-geostore copied to clipboard

Converting property values using json.loads

Open lyralemos opened this issue 3 years ago • 0 comments

I have a small problem with feature properties from imported shapes.

The from_shapefile function tries to use json.loads to append the property value and fallback to the actual value in case of failure.

https://github.com/Terralego/django-geostore/blob/4dc40a0959c83abfd112af823bef5e3b85602ba4/geostore/import_export/imports.py#L49-L55

This is fine except that, if have a string property with only numbers json.loads will change it to integer as this example:

>>> a = '123'
>>> type(json.loads(a))
<class 'int'>

I guess this is not ideal for cases that depend o the property type to be precise, as mine is.

Wouldn't be a better approach to store properties as they came from fiona?

lyralemos avatar Nov 10 '21 14:11 lyralemos