Ejemplo n.º 1
0
def getTimestampsForId(request):
    """ Returns a json document which contains a a list of messtischblatt tuples which
        have the same blattnumber like the given object. """
    try:
        log.info('Receive request for timestamps for a given object number.')
        dbsession = request.db
        object_id = request.GET.get('id')
        object = Messtischblatt.by_id(object_id, dbsession)
        spatial_relation_objects = Messtischblatt.allForBlattnr(
            object.blattnr, dbsession)
        response = []
        for rel_object in spatial_relation_objects:
            if rel_object.isttransformiert:
                time = MdZeit.by_id(rel_object.id, dbsession).datierung
                response.append({
                    'id':
                    rel_object.id,
                    'time':
                    time,
                    'extent':
                    Messtischblatt.getExtent(rel_object.id, dbsession)
                })
        return json.dumps({'maps': response},
                          ensure_ascii=False,
                          encoding='utf-8')
    except DBAPIError:
        return Response(conn_err_msg,
                        content_type='text/plain',
                        status_int=500)
Ejemplo n.º 2
0
def getCollectionForBlattnr(blattnr, session):
    coll =[]
    mtbs = Messtischblatt.allForBlattnr(blattnr, session)
    for mtb in mtbs:
        wms_url = getWmsUrlForMtb(mtb.id, session)
        metadata = MdCore.by_id(mtb.id, session)
        item = {'wms_url':wms_url,'mtbid':mtb.id,'layername':mtb.dateiname,'titel':metadata.titel,
                'zoomify_prop':mtb.zoomify_properties,'zoomify_width':mtb.zoomify_width,
                'zoomify_height':mtb.zoomify_height}
        coll.append(item)
    return coll
Ejemplo n.º 3
0
def getZoomifyCollectionForBlattnr(request, blattnr, session, page=1):
    coll = []
    mtbs = Messtischblatt.allForBlattnr(blattnr, session)
    for mtb in mtbs:
        metadata = MdCore.by_id(mtb.id, session)
        if mtb.mdtype == 'M' and mtb.istaktiv and not mtb.isttransformiert and mtb.hasgeorefparams == 0:
            item = {'mtbid':mtb.id,'layername':mtb.dateiname,'titel':metadata.titel,'titel_short':metadata.titel_short,
                    'zoomify_prop':mtb.zoomify_properties,'zoomify_width':mtb.zoomify_width,'zoomify_height':mtb.zoomify_height}
            coll.append(item)
    # create paginator
    page_url = PageURL_WebOb(request)
    return Page(coll, page, url=page_url, items_per_page=10)
Ejemplo n.º 4
0
def getTimestampsForId(request):
    """ Returns a json document which contains a a list of messtischblatt tuples which
        have the same blattnumber like the given object. """
    try:
        log.info('Receive request for timestamps for a given object number.')
        dbsession = request.db
        object_id = request.GET.get('id')
        object = Messtischblatt.by_id(object_id, dbsession)
        spatial_relation_objects = Messtischblatt.allForBlattnr(object.blattnr, dbsession)
        response = []
        for rel_object in spatial_relation_objects:
            if rel_object.isttransformiert:
                time = MdZeit.by_id(rel_object.id, dbsession).datierung
                response.append({'id':rel_object.id,'time':time,'extent':Messtischblatt.getExtent(rel_object.id, dbsession)})
        return json.dumps({'maps':response}, ensure_ascii=False, encoding='utf-8')
    except DBAPIError:
        return Response(conn_err_msg, content_type='text/plain', status_int=500)