Beispiel #1
0
def roomJacks():

    # Initialize the FieldStorage object so we can get user input
    params = cgi.FieldStorage()

    # Run the query, quoting the user input
    dbconn.send_query("""
            SELECT
                        ST_AsGeoJSON(ST_Union(ST_Transform(ST_Buffer(ST_Transform(st_centroid(rooms.the_geom),3857),12),4326))) AS the_geom,
			split_part(jack,'-',3) AS floor
			FROM access_points,rooms WHERE 
			split_part(jack,'-',2)=""" +
			dbconn.adapt(str(params['building'].value)).getquoted() + """
			AND
			split_part(rooms.room_id, '-', 2)=""" +
			dbconn.adapt(str(params['building'].value)).getquoted() + """
			AND
			lpad(split_part(rooms.room_id, '-', 4),5,'0')=split_part(jack,'-',4) 
                        AND
			split_part(rooms.room_id, '-', 3)=split_part(jack,'-',3)
                        GROUP BY  split_part(jack,'-',3)
    """) 
Beispiel #2
0
def roomJacks():

    # Initialize the FieldStorage object so we can get user input
    params = cgi.FieldStorage()

    # Run the query, quoting the user input
    dbconn.send_query("""
            SELECT
                        ST_AsGeoJSON(ST_Union(ST_Transform(ST_Buffer(ST_Transform(st_centroid(rooms.the_geom),3857),12),4326))) AS the_geom,
			split_part(jack,'-',3) AS floor
			FROM access_points,rooms WHERE 
			split_part(jack,'-',2)=""" +
                      dbconn.adapt(str(params['building'].value)).getquoted() +
                      """
			AND
			split_part(rooms.room_id, '-', 2)=""" +
                      dbconn.adapt(str(params['building'].value)).getquoted() +
                      """
			AND
			lpad(split_part(rooms.room_id, '-', 4),5,'0')=split_part(jack,'-',4) 
                        AND
			split_part(rooms.room_id, '-', 3)=split_part(jack,'-',3)
                        GROUP BY  split_part(jack,'-',3)
    """)
Beispiel #3
0
#!/usr/bin/env python

import sys, os

sys.path.insert(
    0, '../../../steps_sql')  # Add our steps_sql dir to our library path
import dbconn

if os.path.isfile('lidar_bbox.json'):
    print "Content-Type: application/json; charset=utf-8"
    print
    with open('lidar_bbox.json', 'r') as fin:
        print fin.read()
    exit()

js = dbconn.send_query(
    "SELECT id,lasfile,ST_AsGeoJSON(ST_Transform(the_geom,4326)) AS the_geom FROM lidar_bbox"
)

f = open('lidar_bbox.json', 'w')
f.write(js)
f.close()
Beispiel #4
0
#!/usr/bin/env python

import sys
sys.path.insert(
    0, '../../../steps_sql')  # Add our steps_sql dir to our library path
import dbconn

dbconn.send_query(
    "SELECT id,state,ST_AsGeoJSON(ST_Transform(the_geom,4326)) AS the_geom FROM dem_fishnets"
)
Beispiel #5
0
#!/usr/bin/env python

import sys
sys.path.insert(
    0, '../../../steps_sql')  # Add our steps_sql dir to our library path
import dbconn

#!/usr/bin/env python

import sys, os

sys.path.insert(
    0, '../../../steps_sql')  # Add our steps_sql dir to our library path
import dbconn

if os.path.isfile('sa_fishnets.json'):
    print "Content-Type: application/json; charset=utf-8"
    print
    with open('sa_fishnets.json', 'r') as fin:
        print fin.read()
    exit()

js = dbconn.send_query(
    "SELECT id,ST_AsGeoJSON(ST_Transform(the_geom,4326)) AS the_geom FROM sa_fishnets"
)

f = open('sa_fishnets.json', 'w')
f.write(js)
f.close()
#!/usr/bin/env python


# Import the cgi module,json and initialize the database connection
import cgi
import dbconn

# Initialize the FieldStorage object so we can get user input
params = cgi.FieldStorage()

# Run the query, quoting the user input
dbconn.send_query("""
SELECT 
floor,
ST_AsGeoJson(the_geom) AS the_geom 
FROM 
rooms 
WHERE 
building=""" + dbconn.adapt(str(params['building'].value)).getquoted() + """
""") 
#!/usr/bin/env python

import sys
sys.path.insert(0, '../../../steps_sql') # Add our steps_sql dir to our library path
import dbconn

dbconn.send_query("SELECT id,state,ST_AsGeoJSON(ST_Transform(the_geom,4326)) AS the_geom FROM dem_fishnets")
Beispiel #8
0
#!/usr/bin/env python

import sys,os

sys.path.insert(0, '../../../steps_sql') # Add our steps_sql dir to our library path
import dbconn

if os.path.isfile('lidar_bbox.json'):
    print "Content-Type: application/json; charset=utf-8"
    print
    with open('lidar_bbox.json', 'r') as fin:
        print fin.read()
    exit()

js = dbconn.send_query("SELECT id,lasfile,ST_AsGeoJSON(ST_Transform(the_geom,4326)) AS the_geom FROM lidar_bbox")

f = open('lidar_bbox.json', 'w')
f.write(js)
f.close()
#!/usr/bin/env python

import sys
sys.path.insert(0, '../../../steps_sql') # Add our steps_sql dir to our library path
import dbconn

#!/usr/bin/env python

import sys,os

sys.path.insert(0, '../../../steps_sql') # Add our steps_sql dir to our library path
import dbconn

if os.path.isfile('sa_fishnets.json'):
    print "Content-Type: application/json; charset=utf-8"
    print
    with open('sa_fishnets.json', 'r') as fin:
        print fin.read()
    exit()

js = dbconn.send_query("SELECT id,ST_AsGeoJSON(ST_Transform(the_geom,4326)) AS the_geom FROM sa_fishnets")

f = open('sa_fishnets.json', 'w')
f.write(js)
f.close()
#!/usr/bin/env python

# Import the cgi module,json and initialize the database connection
import cgi
import dbconn

# Initialize the FieldStorage object so we can get user input
params = cgi.FieldStorage()

# Run the query, quoting the user input
dbconn.send_query("""
SELECT 
floor,
ST_AsGeoJson(the_geom) AS the_geom 
FROM 
rooms 
WHERE 
building=""" + dbconn.adapt(str(params['building'].value)).getquoted() + """
""")
Beispiel #11
0
#!/usr/bin/env python

# Import the json and initialize the database connection
import dbconn

# Initialize the FieldStorage object so we can get user input

dbconn.send_query("""
SELECT 
building_n,
ST_AsGeoJson(the_geom) AS the_geom 
FROM 
buildings
""")