Skip to content

Commit

Permalink
add local OGC:WMTS endpoint for a given layer (cga-harvard#328)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis committed Oct 17, 2017
1 parent 17fce09 commit c846f88
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions hypermap/aggregator/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,8 @@ def update_layers_wms(service):
# get or create layer
layer, created = Layer.objects.get_or_create(name=ows_layer.name, service=service, catalog=service.catalog)
if layer.active:
links = [['OGC:WMS', service.url]]
links = [['OGC:WMS', service.url],
['OGC:WMTS', settings.SITE_URL.rstrip('/') + '/' + layer.get_url_endpoint()]]
# update fields
layer.type = 'OGC:WMS'
layer.title = ows_layer.title
Expand Down Expand Up @@ -1172,7 +1173,8 @@ def update_layers_wmts(service):
LOGGER.debug('Updating layer %s' % ows_layer.name)
layer, created = Layer.objects.get_or_create(name=ows_layer.name, service=service, catalog=service.catalog)
if layer.active:
links = [['OGC:WMTS', service.url]]
links = [['OGC:WMTS', service.url],
['OGC:WMTS', settings.SITE_URL.rstrip('/') + '/' + layer.get_url_endpoint()]]
layer.type = 'OGC:WMTS'
layer.title = ows_layer.title
layer.abstract = ows_layer.abstract
Expand Down Expand Up @@ -1293,7 +1295,8 @@ def update_layers_wm(service, num_layers=None):
if created:
LOGGER.debug('Added a new layer in registry: %s, %s' % (name, uuid))
if layer.active:
links = [['Hypermap:WorldMap', endpoint]]
links = [['Hypermap:WorldMap', endpoint],
['OGC:WMTS', settings.SITE_URL.rstrip('/') + '/' + layer.get_url_endpoint()]]
# update fields
layer.type = 'Hypermap:WorldMap'
layer.title = title
Expand Down Expand Up @@ -1424,6 +1427,7 @@ def update_layers_warper(service):
layer, created = Layer.objects.get_or_create(name=name, service=service, catalog=service.catalog)
if layer.active:
# update fields
links = [['OGC:WMTS', settings.SITE_URL.rstrip('/') + '/' + layer.get_url_endpoint()]]
layer.type = 'Hypermap:WARPER'
layer.title = title
layer.abstract = abstract
Expand Down Expand Up @@ -1528,7 +1532,8 @@ def update_layers_esri_mapserver(service, greedy_opt=False):
)
if layer.active:
layer.type = 'ESRI:ArcGIS:MapServer'
links = [[layer.type, service.url]]
links = [[layer.type, service.url],
['OGC:WMTS', settings.SITE_URL.rstrip('/') + '/' + layer.get_url_endpoint()]]
layer.title = esri_layer.name
layer.abstract = esri_service.serviceDescription
layer.url = service.url
Expand Down Expand Up @@ -1606,7 +1611,8 @@ def update_layers_esri_imageserver(service):
layer, created = Layer.objects.get_or_create(name=obj['name'], service=service, catalog=service.catalog)
if layer.active:
layer.type = 'ESRI:ArcGIS:ImageServer'
links = [[layer.type, service.url]]
links = [[layer.type, service.url],
['OGC:WMTS', settings.SITE_URL.rstrip('/') + '/' + layer.get_url_endpoint()]]
layer.title = obj['name']
layer.abstract = esri_service.serviceDescription
layer.url = service.url
Expand Down

0 comments on commit c846f88

Please sign in to comment.