Example #1
0
File: wms.py Project: leo831/stoqs
def showActivityWMS(request):
    '''
    Fuller featured Activities view using bootstrap and ajax features of querystoqs.html.
    Displays Resources of activity along with tracks on the map and perhaps a get data button.
    Could be a useful results page from a search of the database.
    '''
    logger.debug("inside showActivityWMS")

    # This queryset could result from a collection of Q objects constructed similar to what STOQSQManager does
    # TODO: Implement this
    qs = mod.Activity.objects.all().order_by('startdate')  
    geo_query = '''geom from (select a.maptrack as geom, a.id as gid, 
        a.name as name, a.comment as comment, a.startdate as startdate, a.enddate as enddate
        from stoqs_activity a)
        as subquery using unique gid using srid=4326'''

    platform_string = ''
    for p in qs:
        platform_string += p.name + ','
    platform_string = platform_string[:-1]

    station_union_layer_string = ''
    # TODO: populate station_union_layer_string and make activityWMS.html
   
    av = ActivityView(request, addAttributeToListItems(qs, 'geo_query', geo_query), 
                      platform_string, station_union_layer_string)

    return av.process_request(webPageTemplate = 'activityWMS.html')
Example #2
0
def showActivityWMS(request):
    '''
    Fuller featured Activities view using bootstrap and ajax features of querystoqs.html.
    Displays Resources of activity along with tracks on the map and perhaps a get data button.
    Could be a useful results page from a search of the database.
    '''
    logger.debug("inside showActivityWMS")

    # This queryset could result from a collection of Q objects constructed similar to what STOQSQManager does
    # TODO: Implement this
    qs = mod.Activity.objects.all().order_by('startdate')  
    geo_query = '''geom from (select a.maptrack as geom, a.id as gid, 
        a.name as name, a.comment as comment, a.startdate as startdate, a.enddate as enddate
        from stoqs_activity a)
        as subquery using unique gid using srid=4326'''

    platform_string = ''
    for p in qs:
        platform_string += p.name + ','
    platform_string = platform_string[:-1]

    station_union_layer_string = ''
    # TODO: populate station_union_layer_string and make activityWMS.html
   
    av = ActivityView(request, addAttributeToListItems(qs, 'geo_query', geo_query), 
                      platform_string, station_union_layer_string)

    return av.process_request(webPageTemplate = 'activityWMS.html')
Example #3
0
def showActivitiesWMS(request):
    '''Render Activities as WMS via mapserver'''

    list = mod.Activity.objects.all().order_by('startdate')  
    geo_query = '''geom from (select a.maptrack as geom, a.id as gid, 
        a.name as name, a.comment as comment, a.startdate as startdate, a.enddate as enddate
        from stoqs_activity a)
        as subquery using unique gid using srid=4326'''

    av = ActivityView(request, addAttributeToListItems(list, 'geo_query', geo_query),'')
    return av.process_request(webPageTemplate = 'activitiesWMS.html')
Example #4
0
def showActivitiesWMS(request):
    '''Render Activities as WMS via mapserver'''

    list = mod.Activity.objects.all().order_by('startdate')
    geo_query = '''geom from (select a.maptrack as geom, a.id as gid, 
        a.name as name, a.comment as comment, a.startdate as startdate, a.enddate as enddate
        from stoqs_activity a)
        as subquery using unique gid using srid=4326'''

    av = ActivityView(request,
                      addAttributeToListItems(list, 'geo_query', geo_query),
                      '')
    return av.process_request(webPageTemplate='activitiesWMS.html')
Example #5
0
def showActivitiesWMSAnimate(request):
    '''Render Activities as WMS via mapserver'''

    list = mod.Activity.objects.all().order_by('startdate')  

    for a in list:
       a.isostartdate = a.startdate.strftime('%Y-%m-%dT%H:%M:%S')
       a.isoenddate = a.enddate.strftime('%Y-%m-%dT%H:%M:%S')

    geo_query = '''geom from (select m.geom as geom, ip.id as gid, ip.timevalue as timevalue 
                from stoqs_instantpoint ip
                inner join stoqs_measurement m on (m.instantpoint_id = ip.id) order by ip.timevalue )
                as subquery using unique gid using srid=4326'''                

    av = ActivityView(request, addAttributeToListItems(list, 'geo_query', geo_query), '', 'activitiesWMSAnimate.html')
    return av.process_request(webPageTemplate='activitiesWMSAnimate.html', mapfile='activitypoint.map')
Example #6
0
File: wms.py Project: leo831/stoqs
def showActivitiesWMS(request):
    '''Render Activities as WMS via mapserver'''

    # This queryset could result from a collection of Q objects constructed similar to what STOQSQManager does
    # TODO: Implement this
    qs = mod.Activity.objects.all().order_by('startdate')  
    geo_query = '''geom from (select a.maptrack as geom, a.id as gid, 
        a.name as name, a.comment as comment, a.startdate as startdate, a.enddate as enddate
        from stoqs_activity a)
        as subquery using unique gid using srid=4326'''

    platform_string = ','.join([p.name for p in qs])
    station_union_layer_string = ''
    # TODO: populate station_union_layer_string and make activityWMS.html

    av = ActivityView(request, addAttributeToListItems(qs, 'geo_query', geo_query),
                      platform_string, station_union_layer_string)

    return av.process_request(webPageTemplate = 'activitiesWMS.html')
Example #7
0
def showActivitiesWMSAnimate(request):
    '''Render Activities as WMS via mapserver'''

    list = mod.Activity.objects.all().order_by('startdate')

    for a in list:
        a.isostartdate = a.startdate.strftime('%Y-%m-%dT%H:%M:%S')
        a.isoenddate = a.enddate.strftime('%Y-%m-%dT%H:%M:%S')

    geo_query = '''geom from (select m.geom as geom, ip.id as gid, ip.timevalue as timevalue 
                from stoqs_instantpoint ip
                inner join stoqs_measurement m on (m.instantpoint_id = ip.id) order by ip.timevalue )
                as subquery using unique gid using srid=4326'''

    av = ActivityView(request,
                      addAttributeToListItems(list, 'geo_query', geo_query),
                      '', 'activitiesWMSAnimate.html')
    return av.process_request(webPageTemplate='activitiesWMSAnimate.html',
                              mapfile='activitypoint.map')
Example #8
0
def showActivitiesWMS(request):
    '''Render Activities as WMS via mapserver'''

    # This queryset could result from a collection of Q objects constructed similar to what STOQSQManager does
    # TODO: Implement this
    qs = mod.Activity.objects.all().order_by('startdate')  
    geo_query = '''geom from (select a.maptrack as geom, a.id as gid, 
        a.name as name, a.comment as comment, a.startdate as startdate, a.enddate as enddate
        from stoqs_activity a)
        as subquery using unique gid using srid=4326'''

    platform_string = ','.join([p.name for p in qs])
    station_union_layer_string = ''
    # TODO: populate station_union_layer_string and make activityWMS.html

    av = ActivityView(request, addAttributeToListItems(qs, 'geo_query', geo_query),
                      platform_string, station_union_layer_string)

    return av.process_request(webPageTemplate = 'activitiesWMS.html')
Example #9
0
File: wms.py Project: leo831/stoqs
def showParametersWMS(request):
    '''Render Activities that have specified parameter as WMS via mapserver'''

    # This queryset could result from a collection of Q objects constructed similar to what STOQSQManager does
    # TODO: Implement this
    qs = mod.Parameter.objects.all().order_by('name')  
    geo_query = '''geom from (select a.maptrack as geom, a.id as aid, p.id as gid,
        a.name as name, a.comment as comment, a.startdate as startdate, a.enddate as enddate
        from stoqs_activity a
        inner join stoqs_activityparameter ap on (a.id = ap.activity_id)
        inner join stoqs_parameter p on (ap.parameter_id = p.id)
        order by p.name)
        as subquery using unique gid using srid=4326'''

    platform_string = ','.join([p.name for p in qs])
    station_union_layer_string = ''
    # TODO: populate station_union_layer_string and make activityWMS.html

    av = ActivityView(request, addAttributeToListItems(qs, 'geo_query', geo_query),
                      platform_string, station_union_layer_string)

    return av.process_request()
Example #10
0
def showParametersWMS(request):
    '''Render Activities that have specified parameter as WMS via mapserver'''

    # This queryset could result from a collection of Q objects constructed similar to what STOQSQManager does
    # TODO: Implement this
    qs = mod.Parameter.objects.all().order_by('name')  
    geo_query = '''geom from (select a.maptrack as geom, a.id as aid, p.id as gid,
        a.name as name, a.comment as comment, a.startdate as startdate, a.enddate as enddate
        from stoqs_activity a
        inner join stoqs_activityparameter ap on (a.id = ap.activity_id)
        inner join stoqs_parameter p on (ap.parameter_id = p.id)
        order by p.name)
        as subquery using unique gid using srid=4326'''

    platform_string = ','.join([p.name for p in qs])
    station_union_layer_string = ''
    # TODO: populate station_union_layer_string and make activityWMS.html

    av = ActivityView(request, addAttributeToListItems(qs, 'geo_query', geo_query),
                      platform_string, station_union_layer_string)

    return av.process_request()