Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Freek Boersma authored and Freek Boersma committed Oct 16, 2019
0 parents commit c62eec5
Show file tree
Hide file tree
Showing 12 changed files with 481 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/sldextract.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

141 changes: 141 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions DBaccess.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import psycopg2

# Initialize database parameters
host = "metis.geodan.nl"
user = "freekb"
dbname = "research"
port = "5432"

mapping = {"OSM_Roads": "freeks_schema.osmweg"}


class DBConnect:

def __init__(self, host="", user="", dbname="", port=""):
self.conn = psycopg2.connect("host={} user={} dbname={} port={}".format(host, user, dbname, port))
self.cur = self.conn.cursor()

def do_query(self, query):
self.cur.execute(query)
return self.cur.fetchall()

def close(self):
self.cur.close()
self.conn.close()
13 changes: 13 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
lxml = "*"
psycopg2 = "*"

[requires]
python_version = "3.7"
66 changes: 66 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added __pycache__/DBaccess.cpython-37.pyc
Binary file not shown.
24 changes: 24 additions & 0 deletions pseudocode.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
for each namedLayer:
layerToQuery = <Name>
if child is namedStyle:
print(Dit is een Namedstyle, weet niet wat ik moet doen)
if child is UserStyle:
for each FeatureTypeStyle:
for each Rule:
if filter exists:
check for and / or
check filter type (equality, >, <)
check min scale, max scale



for each userLayer:
negeer voor nu


TODO:

ogc:function?
spatial operators?
userlayers
geen filter in een rule?
15 changes: 15 additions & 0 deletions querytester.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import DBaccess

db = DBaccess.DBConnect(DBaccess.host, DBaccess.user, DBaccess.dbname, DBaccess.port)

query = """
CREATE TABLE freeks_schema.pytest AS(
SELECT *
FROM freeks_schema.osmweg
LIMIT 10)
"""

db.cur.execute(query)
db.conn.commit()
db.close()

Loading

0 comments on commit c62eec5

Please sign in to comment.