Как настроить геопандас с помощью Django

Я использую это https://gist.github.com/linwoodc3/0306734dfe17076dfd34e09660c198c0 с github для преобразования kmz файла в shp файл. Он отлично работает, когда я запускаю его, используя жестко заданный путь к файлу. Я хочу интегрировать это в мое веб-приложение, которое загружает kmz файл с помощью этой функции:

#Models.py
class FileDocument(models.Model):
    description = models.CharField(max_length=255, blank=True)
    document = models.FileField(upload_to='documents/')
    uploaded_at = models.DateTimeField(auto_now_add=True)```

The file uploads fine into documents folder and has the same size and name as the file on my 
local computer, however when reading the kmz file using the aforementioned function I get the following error:

*No geometry data set yet (expected in column 'geometry'.)*

By printing the dataframes I can see that the geometry column is missing when I upload it 
through django, however rest of the attributes are there.
I think this error has more to do with how Geopandas, Gdal, Geos and other spatial libraries are 
configured in Django vs my virtual environment.
Any help or insight would be appreciated.
Thank you!
Вернуться на верх