def get(self, request, *args, **kwargs): from django.http.request import QueryDict from qdjango.ows import OWSRequestHandler q = QueryDict('', mutable=True) q['SERVICE'] = 'WFS' q['VERSION'] = '1.0.0' q['REQUEST'] = 'GetFeature' q['TYPENAME'] = 'sita:listacomunirtpoly' q['PROPERTYNAME'] = 'ncom' q['PROPERTYNAME'] = 'ncom=VOLTERRA' q['OUTPUFORMAT'] = 'application/json' class Object(object): pass request = Object() request.method = 'GET' request.body = '' response = OWSRequestHandler.baseDoRequest(q, request) return response
def get_qgis_projectsettings_wms(self, instance): """ Exec qgis project setting wms request :param instance: :return: """ q = QueryDict('', mutable=True) q['map'] = instance.qgis_file.file.name q['SERVICE'] = 'WMS' q['VERSION'] = '1.3.0' q['REQUEST'] = 'GetProjectSettings' class Object(object): pass request = Object() request.method = 'GET' request.body = '' response = OWSRequestHandler(None).baseDoRequest(q, request=request) return QgisProjectSettingsWMS(response.content)
def get_qgis_projectsettings_wms(self, instance): """ Exec qgis project setting wms request :param instance: :return: """ if 'qdjango' in settings.CACHES: cache = caches['qdjango'] cache_key = 'qdjango_prjsettings_{}'.format(instance.pk) # try to get from cache cached_response = cache.get(cache_key) if cached_response: return QgisProjectSettingsWMS(cached_response) q = QueryDict('', mutable=True) q['map'] = instance.qgis_file.file.name q['SERVICE'] = 'WMS' q['VERSION'] = '1.3.0' q['REQUEST'] = 'GetProjectSettings' class Object(object): pass request = Object() request.method = 'GET' request.body = '' response = OWSRequestHandler(None).baseDoRequest(q, request=request) if 'qdjango' in settings.CACHES: # set in to cache cache.set(cache_key, response.content) return QgisProjectSettingsWMS(response.content)