コード例 #1
0
#-*- coding: utf-8 -*-

import sys, os, cgi, re
import random
import string
root = "/data/project/polygons/polygons-generation"
sys.path.append(root)
from tools import utils
from tools import OsmGeom

show = utils.show

form = cgi.FieldStorage()

if "name" not in form and "poly" not in form:
    utils.print_header("Importer of .poly files")
    show(u"<h1>%s</h1>" % ("Import of .poly files"))
    show(u"<br><br>\n")
    show(u"<form method='POST' action=''  enctype='multipart/form-data'>")
    show(u"<label for='name'>%s</label>" % "Name")
    show(u"<input type='text' name='name' id='name'>")
    show(u"<label for='poly'>%s</label>" % ".poly file")
    show(u"<input type='file' name='poly' id='poly'>")
    show(u"<input type='submit'>")
    show(u"</form>")
    utils.print_tail()
    sys.exit(0)

import cgitb
cgitb.enable()
コード例 #2
0
root = "/data/project/polygons/polygons-generation"
sys.path.append(root)
from tools import utils

form = cgi.FieldStorage()
rel_id = int(form.getvalue("id", -1))
name = str(form.getvalue("name", ""))

show = utils.show
cgitb.enable()

PgConn = utils.get_dbconn()
PgCursor = PgConn.cursor()

if rel_id == -1 and name == "":
    utils.print_header("Show polygon")
    show(u"<h1>%s</h1>" % ("Show polygon"))
    show(u"<form method='GET' action=''>")
    show(u"<label for='id'>%s</label>" % "Id of relation")
    show(u"<input type='text' name='id' id='id'>")
    show(u"<br>")
    show(u"<label for='name'>%s</label>" % "Name of user polygon")
    show(u"<input type='text' name='name' id='name'>")
    show(u"<input type='submit'>")
    show(u"</form>")
    sys.exit(0)

utils.print_header("Show polygon")

if rel_id != -1:
コード例 #3
0
#-*- coding: utf-8 -*-

import sys, os, cgi, re
import random
import string
root = "/data/project/polygons/polygons-generation"
sys.path.append(root)
from tools import utils
from tools import OsmGeom

show = utils.show

form = cgi.FieldStorage()

if "name" not in form and "poly" not in form:
    utils.print_header("Importer of .poly files")
    show(u"<h1>%s</h1>" % ("Import of .poly files"))
    show(u"<br><br>\n")
    show(u"<form method='POST' action=''  enctype='multipart/form-data'>")
    show(u"<label for='name'>%s</label>" % "Name")
    show(u"<input type='text' name='name' id='name'>")
    show(u"<label for='poly'>%s</label>" % ".poly file")
    show(u"<input type='file' name='poly' id='poly'>")
    show(u"<input type='submit'>")
    show(u"</form>")
    utils.print_tail()
    sys.exit(0)

import cgitb
cgitb.enable()
コード例 #4
0
PgConn = utils.get_dbconn()
PgCursor = PgConn.cursor()


def get_state_timestamp(name):
    f = open(name)
    for line in f:
        (key, sep, value) = line.partition("=")
        if key.strip() == "timestamp":
            return value.replace("\\", "")

    return ""


if rel_id == -1:
    utils.print_header("Polygon creation")
    show(u"<h1>%s</h1>" % ("Polygon creation"))
    show(u"<p>Database was last updated on: %s</p>" %
         get_state_timestamp("/data/work/osmbin/replication/state.txt"))
    show(
        u"<p>This will generate the whole geometry of the given OSM relation id, with the corresponding sub-relations. When the geometry is available, it is possible to generate simplified geometries from this one, and export them as .poly, GeoJSON, WKT or image formats.</p>"
    )
    show(u"<form method='GET' action=''>")
    show(u"<label for='id'>%s</label>" % "Id of relation")
    show(u"<input type='text' name='id' id='id'>")
    show(u"<input type='submit'>")
    show(u"</form>")
    show(u"<br>\n")

    show(u"<h1>%s</h1>" % ("Import of an user polygon"))
    show(
コード例 #5
0
root = "/home/jocelyn/polygon-generation"
sys.path.append(root)
from tools import utils

form   = cgi.FieldStorage()
rel_id = int(form.getvalue("id", -1))
name   = str(form.getvalue("name", ""))

show = utils.show
cgitb.enable()

PgConn    = utils.get_dbconn()
PgCursor  = PgConn.cursor()

if rel_id == -1 and name == "":
    utils.print_header("Show polygon")
    show(u"<h1>%s</h1>" % ("Show polygon"))
    show(u"<form method='GET' action=''>")
    show(u"<label for='id'>%s</label>" % "Id of relation")
    show(u"<input type='text' name='id' id='id'>")
    show(u"<br>")
    show(u"<label for='name'>%s</label>" % "Name of user polygon")
    show(u"<input type='text' name='name' id='name'>")
    show(u"<input type='submit'>")
    show(u"</form>")
    sys.exit(0)

utils.print_header("Show polygon")

if rel_id != -1:
コード例 #6
0
PgConn    = utils.get_dbconn()
PgCursor  = PgConn.cursor()

def get_state_timestamp(name):
    f = open(name)
    for line in f:
        (key, sep, value) = line.partition("=")
        if key.strip() == "timestamp":
            return value.replace("\\", "")

    return ""


if rel_id == -1:
    utils.print_header("Polygon creation")
    show(u"<h1>%s</h1>" % ("Polygon creation"))
    show(u"<p>Database was last updated on: %s</p>" % get_state_timestamp("/data/work/osmbin/replication/state.txt"))
    show(u"<p>This will generate the whole geometry of the given OSM relation id, with the corresponding sub-relations. When the geometry is available, it is possible to generate simplified geometries from this one, and export them as .poly, GeoJSON, WKT or image formats.</p>")
    show(u"<form method='GET' action=''>")
    show(u"<label for='id'>%s</label>" % "Id of relation")
    show(u"<input type='text' name='id' id='id'>")
    show(u"<input type='submit'>")
    show(u"</form>")
    show(u"<br>\n")

    show(u"<h1>%s</h1>" % ("Import of an user polygon"))
    show(u"<p>Use this if you want to import your own .poly file, and do union operations with OSM relations.</p>")
    show(u"<form method='POST' action='import_poly.py' enctype='multipart/form-data'>")
    show(u"<label for='name'>%s</label>" % "Name")
    show(u"<input type='text' name='name' id='name'>")