Skip to content

Commit

Permalink
fix: Use style that preserves refs for ways
Browse files Browse the repository at this point in the history
  • Loading branch information
rsavoye committed Nov 17, 2023
1 parent c3c4af2 commit c230395
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 45 deletions.
9 changes: 0 additions & 9 deletions osm_rawdata/geofabrik.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
# - Asia
# - Central America
# - South America
# - Antarctica
# - Australia and Oceania
# - Europe
# - North America

# http://download.geofabrik.de/africa/algeria-latest.osm.pbf
- Africa:
- Algeria
- Angola
Expand Down
2 changes: 1 addition & 1 deletion osm_rawdata/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def importOSM(
"--extra-attributes",
"--output=flex",
"--style",
f"{rootdir}/raw.lua",
f"{rootdir}/raw_with_ref.lua",
f"{infile}",
]
)
Expand Down
40 changes: 5 additions & 35 deletions osm_rawdata/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,31 +478,7 @@ def __init__(
log.error(f"{path} is an unsupported file format!")
quit()

def createTable(
self,
sql: str,
):
"""Create a table in the database
Args:
sqlfile (str): The SQL
Returns:
(bool): The table creation status
"""
log.info("Creating table schema")
result = self.dbcursor.execute(sql)

# path = Path(sqlfile)
# sql = f"INSERT INTO schemas(schema, version) VALUES('{sqlfile.stem}', 1.0)"
# result = self.pg.dbcursor.execute(sql)

return True

def createDB(
self,
dburi: uriParser = None,
):
def createDB(self, dburi: uriParser):
"""Setup the postgres database connection.
Args:
Expand All @@ -511,20 +487,14 @@ def createDB(
Returns:
status (bool): Whether the data base connection was sucessful
"""
if dburi:
uri = dburi
else:
uri = self.uri
sql = f"SELECT * FROM pg_database WHERE datname = '{uri['dbname']}'"
sql = f"CREATE DATABASE IF NOT EXISTS {self.dbname}"
self.dbcursor.execute(sql)
result = self.dbcursor.fetchall()
# log.info("Query returned %d records" % len(result))
if len(result) > 0:
log.warning(f"Database {uri['dbname']} already exists!")
return True
log.info("Query returned %d records" % len(result))
# result = subprocess.call("createdb", uri.dbname)

# Add the extensions needed
sql = f"CREATE DATABASE {uri['dbname']}; CREATE EXTENSION postgis; CREATE EXTENSION hstore;"
sql = "CREATE EXTENSION postgis; CREATE EXTENSION hstore;"
self.dbcursor.execute(sql)
result = self.dbcursor.fetchall()
log.info("Query returned %d records" % len(result))
Expand Down

0 comments on commit c230395

Please sign in to comment.