django-gisserver 1.2.6__py3-none-any.whl → 1.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-gisserver
3
- Version: 1.2.6
3
+ Version: 1.3.0
4
4
  Summary: Django speaking WFS 2.0 (exposing GeoDjango model fields)
5
5
  Home-page: https://github.com/amsterdam/django-gisserver
6
6
  Author: Diederik van der Boor
@@ -1,4 +1,4 @@
1
- gisserver/__init__.py,sha256=tTx11FTfmFhTJCX4ca2mTNo5UfhYe-yD7kuD7bYTvG0,40
1
+ gisserver/__init__.py,sha256=BfdKG3T6jfPrJ5AF8bDHgTsS70jBTw-Eg3IjeDKAlPQ,40
2
2
  gisserver/conf.py,sha256=DC3TNBhA2kcLxTwmzhmrW5Noiv2QsPQms_EAAZLtO-4,2108
3
3
  gisserver/db.py,sha256=4NSxzwCLsTON2wrLBKZweg6kOlZelV4fzdsrMGpC7V8,5329
4
4
  gisserver/exceptions.py,sha256=kf6o-Vk9CrAAcjk4uGlQVvXnuYOBVks4pcQly3pKRPU,4596
@@ -7,15 +7,15 @@ gisserver/geometries.py,sha256=PEmYKV8yw1fjwL6ortc1w72UOByRHz88NDEyPuO3qFo,12619
7
7
  gisserver/types.py,sha256=dfybev3kq1IO3jaIy9uETOqHwqQOzEG94fKEbQB-AEQ,34202
8
8
  gisserver/views.py,sha256=Z55WA8Qc5OpP0ONPMPGqs-66w0ZR9XpDs9fJ8toqda4,13252
9
9
  gisserver/operations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- gisserver/operations/base.py,sha256=sSd_9lHe_tduSMroVhpkD7aPFysf06atbYTXwma2OO0,16780
11
- gisserver/operations/wfs20.py,sha256=psqoIWkkp6r7S3eF_dGpb8YoV7G2BV0FjrdRYsQXMkI,18240
10
+ gisserver/operations/base.py,sha256=XFW9Y9oOHzdPou3cfZQ2UWCZbDba23MBydbN6owfomc,17012
11
+ gisserver/operations/wfs20.py,sha256=J54vnxEE_8Myz5uwnjltElun_H1MvKQNeWZNjIWiDF4,18635
12
12
  gisserver/output/__init__.py,sha256=kWdJHxKtQNKK4Bld8uNdVqk3cjgpiagBL_FlMjsbjQc,1950
13
13
  gisserver/output/base.py,sha256=W4017N2qlEuPCbXLl17SQUVfTpTZphiSURd75NR9Hac,7954
14
14
  gisserver/output/buffer.py,sha256=Jqw94wa1YFcKbFB9ZLiYx2L0TRD1MDZNLF5te3QBqgU,1542
15
- gisserver/output/csv.py,sha256=hBaLQPYLdzFrspoP237tPCwMXfH8px8q9ZkQouklLFg,6198
16
- gisserver/output/geojson.py,sha256=0ziMwsIxHr7ieJEPAQ8wmERCFw5UPYsHiOz4w0LPhUc,11236
17
- gisserver/output/gml32.py,sha256=dkKUENiynw_ZOF7Btz-Xr_PWrjwHJUOaFB6QCSXnnE4,26913
18
- gisserver/output/results.py,sha256=oZ_hHt9_N3FGhxQawMZ6V6bhDNlcYo-r7Tv6b9aRFp4,9189
15
+ gisserver/output/csv.py,sha256=sVj1U1dVkMqm-cwjGbnDg-YLQL1QcRMXyH6LqgC7tN4,6179
16
+ gisserver/output/geojson.py,sha256=a8A628p1PEF-fmKdm3CrGDyCRPZdukMZRNzjiqDosWY,11217
17
+ gisserver/output/gml32.py,sha256=_IN5ehNLGPk5z3euIxavukjYsoHn6liPqY__Ge7LpjY,26894
18
+ gisserver/output/results.py,sha256=JdOznMx1xDxSmekMWW5YyF_muzrJXd6DVy0qqs2ewKI,9224
19
19
  gisserver/output/utils.py,sha256=fMUPnAKXiT5IX3GlO0amZKzd_8ixNG_g1lgmZ3aNyGo,6113
20
20
  gisserver/output/xmlschema.py,sha256=JVYx5ZXeIt4v8HLsEcRg5dR9WcrOREctlGaHcn31rEw,4603
21
21
  gisserver/parsers/__init__.py,sha256=g72D8EtR-QkhcemzY5-Qty-nhHPKza83Sz3KZm8bfq0,290
@@ -47,8 +47,8 @@ gisserver/templates/gisserver/wfs/2.0.0/get_capabilities.xml,sha256=KKrI0YYQqZWt
47
47
  gisserver/templates/gisserver/wfs/2.0.0/list_stored_queries.xml,sha256=CIBVQrKXmGMQ6BKbX4_0ru4lXtWnW5EIgHUbIi1V0Vc,636
48
48
  gisserver/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
49
  gisserver/templatetags/gisserver_tags.py,sha256=RFGqEj-EQi9FrJiFJ7HHAQqlU4fDKVKTtZrPNwURXgA,204
50
- django_gisserver-1.2.6.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
51
- django_gisserver-1.2.6.dist-info/METADATA,sha256=Aq56IgCmkl4rZjbLwEM-M5Ivr-y3fOHyCOCHLdalgek,5834
52
- django_gisserver-1.2.6.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
53
- django_gisserver-1.2.6.dist-info/top_level.txt,sha256=8zFCEMmkpixE4TPiOAlxSq3PD2EXvAeFKwG4yZoIIOQ,10
54
- django_gisserver-1.2.6.dist-info/RECORD,,
50
+ django_gisserver-1.3.0.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
51
+ django_gisserver-1.3.0.dist-info/METADATA,sha256=N9SdE0qRO4HBR8MW1XiTo45KOvPeFWTA_k3p0q_iH5s,5834
52
+ django_gisserver-1.3.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
53
+ django_gisserver-1.3.0.dist-info/top_level.txt,sha256=8zFCEMmkpixE4TPiOAlxSq3PD2EXvAeFKwG4yZoIIOQ,10
54
+ django_gisserver-1.3.0.dist-info/RECORD,,
gisserver/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.2.6" # follows PEP440
1
+ __version__ = "1.3.0" # follows PEP440
@@ -158,6 +158,10 @@ class OutputFormat:
158
158
 
159
159
  def matches(self, value):
160
160
  """Test whether the 'value' is matched by this object."""
161
+ if self.content_type == "application/gml+xml":
162
+ # Allow "application/gml+xml; version=3.2" as sent by FME.
163
+ # TODO rewrite this matching code in a clean way.
164
+ value = value.split("; ", 1)[0]
161
165
  return self.content_type == value or self.subtype == value
162
166
 
163
167
  @property
@@ -45,7 +45,15 @@ RE_SAFE_FILENAME = re.compile(r"\A[A-Za-z0-9]+[A-Za-z0-9.]*") # no dot at the s
45
45
  class GetCapabilities(WFSMethod):
46
46
  """ "This operation returns map features, and available operations this WFS server supports."""
47
47
 
48
- output_formats = [OutputFormat("text/xml")]
48
+ output_formats = [
49
+ OutputFormat(
50
+ "application/gml+xml",
51
+ version="3.2",
52
+ renderer_class=output.gml32_value_renderer,
53
+ title="GML",
54
+ ),
55
+ OutputFormat("text/xml"),
56
+ ]
49
57
  xml_template_name = "get_capabilities.xml"
50
58
 
51
59
  def get_parameters(self):
@@ -144,8 +152,11 @@ class DescribeFeatureType(WFSTypeNamesMethod):
144
152
  # At least one version of FME seems to sends a DescribeFeatureType
145
153
  # request with this output format. Do what mapserver does and just
146
154
  # send it XML Schema.
147
- OutputFormat("application/gml+xml; version=3.2",
148
- renderer_class=output.XMLSchemaRenderer)
155
+ OutputFormat(
156
+ "application/gml+xml",
157
+ version="3.2",
158
+ renderer_class=output.XMLSchemaRenderer,
159
+ )
149
160
  # OutputFormat("text/xml", subtype="gml/3.1.1"),
150
161
  ]
151
162
 
@@ -441,7 +452,7 @@ class GetFeature(BaseWFSGetDataMethod):
441
452
  OutputFormat(
442
453
  # Alias needed to make ESRI ArcGIS online accept the WFS.
443
454
  # It does not recognize the "subtype" as an alias.
444
- "GEOJSON",
455
+ "geojson",
445
456
  renderer_class=output.geojson_renderer,
446
457
  ),
447
458
  OutputFormat(
@@ -462,6 +473,12 @@ class GetPropertyValue(BaseWFSGetDataMethod):
462
473
  """
463
474
 
464
475
  output_formats = [
476
+ OutputFormat(
477
+ "application/gml+xml",
478
+ version="3.2",
479
+ renderer_class=output.gml32_value_renderer,
480
+ title="GML",
481
+ ),
465
482
  OutputFormat(
466
483
  "text/xml", subtype="gml/3.2", renderer_class=output.gml32_value_renderer
467
484
  ),
gisserver/output/csv.py CHANGED
@@ -2,11 +2,10 @@
2
2
  from __future__ import annotations
3
3
 
4
4
  import csv
5
- from datetime import datetime
5
+ from datetime import datetime, timezone
6
6
 
7
7
  from django.conf import settings
8
8
  from django.db import models
9
- from django.utils.timezone import utc
10
9
 
11
10
  from gisserver import conf
12
11
  from gisserver.db import (
@@ -137,7 +136,7 @@ class CSVRenderer(OutputRenderer):
137
136
  # Array field
138
137
  append(",".join(map(str, value)))
139
138
  elif isinstance(value, datetime):
140
- append(str(value.astimezone(utc)))
139
+ append(str(value.astimezone(timezone.utc)))
141
140
  else:
142
141
  append(value)
143
142
  return values
@@ -1,5 +1,5 @@
1
1
  """Output rendering logic for GeoJSON."""
2
- from datetime import datetime
2
+ from datetime import datetime, timezone
3
3
  from decimal import Decimal
4
4
  from typing import cast
5
5
 
@@ -8,7 +8,6 @@ from django.conf import settings
8
8
  from django.contrib.gis.db.models.functions import AsGeoJSON
9
9
  from django.db import models
10
10
  from django.utils.functional import Promise
11
- from django.utils.timezone import utc
12
11
 
13
12
  from gisserver import conf
14
13
  from gisserver.db import get_db_geometry_target
@@ -147,7 +146,7 @@ class GeoJsonRenderer(OutputRenderer):
147
146
 
148
147
  def _format_geojson_value(self, value):
149
148
  if isinstance(value, datetime):
150
- return value.astimezone(utc)
149
+ return value.astimezone(timezone.utc)
151
150
  elif isinstance(value, models.Model):
152
151
  # ForeignKey, not defined as complex type.
153
152
  return str(value)
gisserver/output/gml32.py CHANGED
@@ -7,14 +7,13 @@ from __future__ import annotations
7
7
 
8
8
  import itertools
9
9
  import re
10
- from datetime import date, datetime, time
10
+ from datetime import date, datetime, time, timezone
11
11
  from html import escape
12
12
  from typing import cast
13
13
 
14
14
  from django.contrib.gis import geos
15
15
  from django.db import models
16
16
  from django.http import HttpResponse
17
- from django.utils.timezone import utc
18
17
 
19
18
  from gisserver.db import (
20
19
  AsGML,
@@ -306,7 +305,7 @@ class GML32Renderer(OutputRenderer):
306
305
  # Expanded foreign relation / dictionary
307
306
  return self.render_xml_complex_type(feature_type, xsd_element, value)
308
307
  elif isinstance(value, datetime):
309
- value = value.astimezone(utc).isoformat()
308
+ value = value.astimezone(timezone.utc).isoformat()
310
309
  elif isinstance(value, (date, time)):
311
310
  value = value.isoformat()
312
311
  elif isinstance(value, bool):
@@ -13,7 +13,9 @@ from typing import Iterable
13
13
  import django
14
14
  from django.db import models
15
15
  from django.utils.functional import cached_property
16
- from django.utils.timezone import now, utc
16
+ from django.utils.timezone import now
17
+
18
+ from datetime import timezone
17
19
 
18
20
  from gisserver.features import FeatureType
19
21
  from gisserver.geometries import BoundingBox
@@ -218,7 +220,7 @@ class FeatureCollection:
218
220
  self.next = next
219
221
  self.previous = previous
220
222
  self.date = now()
221
- self.timestamp = self.date.astimezone(utc).isoformat()
223
+ self.timestamp = self.date.astimezone(timezone.utc).isoformat()
222
224
 
223
225
  def get_bounding_box(self) -> BoundingBox:
224
226
  """Determine bounding box of all items."""