Esempio n. 1
0
def getPage_profileMtb(request):
    try:
        messtischblatt_id = None
        if "objectid" in request.params:
            messtischblatt_id = request.params["objectid"]
            log.info("Receive get map profile page for id %s." % messtischblatt_id)

        georef = False
        if "georef" in request.params and request.params["georef"].lower() == "true":
            georef = True

        if georef:
            permalink = createPermalink(request, messtischblatt_id)
            return HTTPFound(location=permalink)

        messtischblatt = Messtischblatt.by_id(messtischblatt_id, request.db)
        metadata = MdCore.by_id(messtischblatt.id, request.db)
        metadata_datensatz = MdDatensatz.by_ObjectId(messtischblatt.id, request.db)
        return {
            "zoomify_prop": messtischblatt.zoomify_properties,
            "zoomify_width": messtischblatt.zoomify_width,
            "zoomify_height": messtischblatt.zoomify_height,
            "key": "vk20-md-%s" % messtischblatt.id,
            "titel_long": metadata.titel,
            "titel_short": metadata.titel_short,
            "permalink": metadata_datensatz.permalink,
        }
    except:
        log.error(
            "Internal server error while trying to get profile page. Please try again or contact the page administrator."
        )
        raise InternalAuthentificationError(
            "Internal server error while trying to get profile page. Please try again or contact the page administrator."
        )
Esempio n. 2
0
def getPage_profileMtb(request):
    try:
        messtischblatt_id = None
        if 'objectid' in request.params:
            messtischblatt_id = request.params['objectid']
            log.info('Receive get map profile page for id %s.' %
                     messtischblatt_id)

        georef = False
        if 'georef' in request.params and request.params['georef'].lower(
        ) == 'true':
            georef = True

        if georef:
            permalink = createPermalink(request, messtischblatt_id)
            return HTTPFound(location=permalink)

        messtischblatt = Messtischblatt.by_id(messtischblatt_id, request.db)
        metadata = MdCore.by_id(messtischblatt.id, request.db)
        metadata_datensatz = MdDatensatz.by_ObjectId(messtischblatt.id,
                                                     request.db)
        return {
            'zoomify_prop': messtischblatt.zoomify_properties,
            'zoomify_width': messtischblatt.zoomify_width,
            'zoomify_height': messtischblatt.zoomify_height,
            'key': 'vk20-md-%s' % messtischblatt.id,
            'titel_long': metadata.titel,
            'titel_short': metadata.titel_short,
            'permalink': metadata_datensatz.permalink
        }
    except:
        log.error(
            'Internal server error while trying to get profile page. Please try again or contact the page administrator.'
        )
        raise InternalAuthentificationError(
            'Internal server error while trying to get profile page. Please try again or contact the page administrator.'
        )
Esempio n. 3
0
def getMetadataForMesstischblatt(id, db, logger):
    try:
        logger.debug('Start collection metadata information')
        mtb = Messtischblatt.by_id(id, db)
        metadata_core = MdCore.by_id(id, db)
        
        mdZeit = MdZeit.by_id(id, db)
        if mdZeit.datierung is None:
            metadata_time = ''
        else: 
            metadata_time = mdZeit.datierung
        metadata_dataset = MdDatensatz.by_ObjectId(id, db)
        
        logger.debug('Metadata collection finish. Creating response')
        metadata = {
                    'westBoundLongitude':str(mtb.BoundingBoxObj.llc.x),
                    'eastBoundLongitude':str(mtb.BoundingBoxObj.urc.x),
                    'southBoundLatitude':str(mtb.BoundingBoxObj.llc.y),
                    'northBoundLatitude':str(mtb.BoundingBoxObj.urc.y),
                    'identifier':'vk20-md-%s'%mtb.id,
                    'dateStamp': datetime.now().strftime('%Y-%m-%d'),
                    'title': metadata_core.titel,
                    'cite_date': str(metadata_time),
                    'abstract': metadata_core.beschreibung,
                    'temporalExtent_begin': '%s-01-01'%metadata_time,
                    'temporalExtent_end': '%s-12-31'%metadata_time,
                    'permalink': metadata_dataset.permalink, 
                    'hierarchylevel': 'Messtischblatt' if mtb.mdtype == 'M' else 'Äquidistantenkarte', 
                    'overviews': [
#                         'http://fotothek.slub-dresden.de/mids/df/dk/0010000/%s.jpg'%mtb.dateiname,
#                         
#                         TEMPLATE_OGC_SERVICE_LINK['wms_template']%({
#                             'westBoundLongitude':str(mtb.BoundingBoxObj.llc.x),
#                             'southBoundLatitude':str(mtb.BoundingBoxObj.llc.y),
#                             'eastBoundLongitude':str(mtb.BoundingBoxObj.urc.x),
#                             'northBoundLatitude':str(mtb.BoundingBoxObj.urc.y),
#                             'srid':DATABASE_SRID,
#                             'time':metadata_time.datierung,
#                             'width':256,
#                             'height':256
#                         }),
                        'http://fotothek.slub-dresden.de/thumbs/df/dk/0010000/%s.jpg'%mtb.dateiname
                    ],
                    'wms_params': {
                        'westBoundLongitude':str(mtb.BoundingBoxObj.llc.x),
                        'southBoundLatitude':str(mtb.BoundingBoxObj.llc.y),
                        'eastBoundLongitude':str(mtb.BoundingBoxObj.urc.x),
                        'northBoundLatitude':str(mtb.BoundingBoxObj.urc.y),
                        'srid':DATABASE_SRID,
                        'time':metadata_time,
                        'width':256,
                        'height':256
                    },
                    'onlineresource':[
                        {
                            'url':'http://kartenforum.slub-dresden.de/vkviewer/permalink?objectid=%s'%mtb.id,
                            'protocol':'HTTP',
                            'name':'Permalink'
                        },
                        {
                            'url':TEMPLATE_OGC_SERVICE_LINK['wms_template']%({
                                'westBoundLongitude':str(mtb.BoundingBoxObj.llc.x),
                                'southBoundLatitude':str(mtb.BoundingBoxObj.llc.y),
                                'eastBoundLongitude':str(mtb.BoundingBoxObj.urc.x),
                                'northBoundLatitude':str(mtb.BoundingBoxObj.urc.y),
                                'srid':DATABASE_SRID,
                                'time':metadata_time,
                                'width':256,
                                'height':256
                            }),
                            'protocol':'OGC:WMS-1.1.1-http-get-map',
                            'name':'WEB MAP SERVICE (WMS)'
                        },
                        {
                            'url':metadata_dataset.permalink,
                            'protocol':'HTTP',
                            'name':'Permalink'
                        }                        
                    ]
        }
        return metadata
    except:
        logger.error('Problems while trying to collect the metadata for the messtischblatt with id %s'%id)
        raise