Skip to content
Snippets Groups Projects
Commit 142a4987 authored by m431m's avatar m431m
Browse files

Improved data sql request (with srid, with unique)

parent 02ca84e1
No related branches found
No related tags found
No related merge requests found
...@@ -291,6 +291,9 @@ class Mapfile(MetadataMixin): ...@@ -291,6 +291,9 @@ class Mapfile(MetadataMixin):
self.ms.setProjection("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs") self.ms.setProjection("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
self.ms.setExtent(-180,-90,180,90) self.ms.setExtent(-180,-90,180,90)
self.ms.units = mapscript.MS_DD self.ms.units = mapscript.MS_DD
self.set_metadata("ows_title", "OGC Web Service")
self.set_metadata("ows_srs", "EPSG:4326")
for ows in ("wms", "wfs", "wcs"): for ows in ("wms", "wfs", "wcs"):
self.set_metadata("%s_enable_request" % ows, "") self.set_metadata("%s_enable_request" % ows, "")
else: else:
...@@ -446,6 +449,11 @@ class FeatureTypeModel(LayerModel): ...@@ -446,6 +449,11 @@ class FeatureTypeModel(LayerModel):
connection += " ".join("%s=%s" % (p, cparam[p]) for p in ["user", "password"] if p in cparam) connection += " ".join("%s=%s" % (p, cparam[p]) for p in ["user", "password"] if p in cparam)
self.ms.connection = connection self.ms.connection = connection
self.ms.data = '%s FROM %s."%s"' % (ds[ft_name].get_geometry_column(), cparam.get("schema", "public"), ft_name) self.ms.data = '%s FROM %s."%s"' % (ds[ft_name].get_geometry_column(), cparam.get("schema", "public"), ft_name)
if ft.get_fid_column() is not None:
self.ms.data += ' USING UNIQUE %s' % ft.get_fid_column()
print(ft.get_authority_name(), ft.get_authority_code())
if ft.get_authority_code() is not None:
self.ms.data += ' USING SRID=%s' % ft.get_authority_code()
# self.set_metadata("ows_extent", "%s %s %s %s" % # self.set_metadata("ows_extent", "%s %s %s %s" %
# (ft.get_extent().minX(), ft.get_extent().minY(), # (ft.get_extent().minX(), ft.get_extent().minY(),
# ft.get_extent().maxX(), ft.get_extent().maxY())) # ft.get_extent().maxX(), ft.get_extent().maxY()))
...@@ -634,7 +642,10 @@ class Workspace(Mapfile): ...@@ -634,7 +642,10 @@ class Workspace(Mapfile):
copy = info copy = info
for m in path[:-1]: for m in path[:-1]:
copy = copy.get(m) copy = copy.get(m)
del copy[path[-1]] try:
del copy[path[-1]]
except:
pas
return info return info
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment