OpenUpSA / wazimap

Wazimap is a Django application for exploring census data.
http://wazimap.readthedocs.org/en/latest/
Other
30 stars 31 forks source link

Support shapefile downloads #84

Open longhotsummer opened 7 years ago

longhotsummer commented 7 years ago

The SHP format is a bit restrictive. We have the code but have errors like this because field names are truncated.

2017-04-10T15:24:59.863053575Z app[web.1]: Warning 6: Normalized/laundered field name: 'VOICE OF INDEPENDENTS PARTY' to 'VOICE OF I'
2017-04-10T15:24:59.863084113Z app[web.1]: Warning 6: Normalized/laundered field name: 'VRYHEIDSFRONT PLUS' to 'VRYHEIDSFR'
2017-04-10T15:24:59.863123700Z app[web.1]: Warning 6: Normalized/laundered field name: 'WESTERN CAPE COMMUNITY' to 'WESTERN CA'
2017-04-10T15:24:59.863161316Z app[web.1]: Warning 6: Normalized/laundered field name: 'WORKING-TOGETHER POLITICAL PARTY' to 'WORKING-TO'
2017-04-10T15:24:59.863200219Z app[web.1]: Warning 6: Normalized/laundered field name: 'XIMOKO PARTY' to 'XIMOKO PAR'
2017-04-10T15:25:00.331615816Z app[web.1]: 2017-04-10 17:25:00,329 ERROR base 188 139863709970992 Internal Server Error: /api/1.0/data/download/latest
2017-04-10T15:25:00.331641894Z app[web.1]: Traceback (most recent call last):
2017-04-10T15:25:00.331647134Z app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py", line 149, in get_response
2017-04-10T15:25:00.331651056Z app[web.1]:     response = self.process_exception_by_middleware(e, request)
2017-04-10T15:25:00.331654648Z app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py", line 147, in get_response
2017-04-10T15:25:00.331658353Z app[web.1]:     response = wrapped_callback(request, *callback_args, **callback_kwargs)
2017-04-10T15:25:00.331661911Z app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/decorators.py", line 184, in inner
2017-04-10T15:25:00.331665389Z app[web.1]:     return func(*args, **kwargs)
2017-04-10T15:25:00.331669218Z app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/newrelic-2.40.0.34/newrelic/hooks/framework_django.py", line 497, in wrapper
2017-04-10T15:25:00.331672769Z app[web.1]:     return wrapped(*args, **kwargs)
2017-04-10T15:25:00.331675974Z app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/views/generic/base.py", line 68, in view
2017-04-10T15:25:00.331679309Z app[web.1]:     return self.dispatch(request, *args, **kwargs)
2017-04-10T15:25:00.331682536Z app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/newrelic-2.40.0.34/newrelic/hooks/framework_django.py", line 835, in wrapper
2017-04-10T15:25:00.331685921Z app[web.1]:     return wrapped(*args, **kwargs)
2017-04-10T15:25:00.331689053Z app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/views/generic/base.py", line 88, in dispatch
2017-04-10T15:25:00.331692394Z app[web.1]:     return handler(request, *args, **kwargs)
2017-04-10T15:25:00.331695887Z app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/wazimap/views.py", line 180, in get
2017-04-10T15:25:00.331699227Z app[web.1]:     return self.download(request)
2017-04-10T15:25:00.331711555Z app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/wazimap/views.py", line 209, in download
2017-04-10T15:25:00.331715582Z app[web.1]:     content, fname, mime_type = mgr.generate_download_bundle(self.tables, self.data_geos, self.geo_ids, data, fmt)
2017-04-10T15:25:00.331719032Z app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/wazimap/data/download.py", line 97, in generate_download_bundle
2017-04-10T15:25:00.331723348Z app[web.1]:     out_feat.SetField(str(column_id), est)
2017-04-10T15:25:00.331726573Z app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/osgeo/ogr.py", line 2708, in SetField
2017-04-10T15:25:00.331739285Z app[web.1]:     return _ogr.Feature_SetField(self, *args)
2017-04-10T15:25:00.331742853Z app[web.1]: RuntimeError: No such field: 'AFRICAN NATIONAL CONGRESS'