This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x-geom | |
substr(to_string(geom_to_wkt(transform( $geometry ,'EPSG:4326','EPSG:3857'))),7,16) | |
y-geom | |
substr(to_string(geom_to_wkt(transform( $geometry ,'EPSG:4326','EPSG:3857'))),25,16) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psycopg2 | |
conn = psycopg2.connect(host='localhost', user='someuser', port='5432', password='verysecretpwd', database='myDbName') | |
cur = conn.cursor() | |
def generate_poi_translation_template(filename): | |
# query the database table for the list of names you want to translate | |
sel_building_floor_id = """SELECT f.cat_name FROM ( | |
SELECT DISTINCT ON (cat_name) cat_name, parent_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update tableName set columnName = json_build_object('keyfieldname1',fieldname1,'keyfieldname2',fieldname2) | |
-- keyfieldname1 is any text name you give to the key | |
-- fieldname1 is an existing column name you have in your table | |
-- docs https://www.postgresql.org/docs/9.5/static/functions-json.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
df = pd.read_csv('..\data\hospitals.csv') | |
#print(df.to_json(orient='records')) | |
with open('..\data\hospitals.json', 'w') as outfile: | |
outfile.write(df.to_json(orient='records')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" | |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get install postgresql-9.6 | |
sudo apt-get install postgresql-9.6-postgis-2.3 | |
sudo apt-get install postgresql-9.6-pgrouting | |
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable | |
sudo apt-get update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# original post http://askubuntu.com/questions/831262/how-to-install-pgadmin-4-in-desktop-mode-on-ubuntu-16-04 | |
sudo apt-get install python3-venv python3-pip libpq-dev python3-dev | |
mkdir myVenvs | |
cd myVenvs | |
pyvenv pgadmin4-ve | |
source pgadmin4-v/bin/activate | |
wget https://ftp.postgresql.org/pub/pgadmin3/pgadmin4/v1.1/pip/pgadmin4-1.1-py3-none-any.whl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#In a terminal, type: | |
sudo -u postgres psql postgres | |
# this connects as a role with same name as the local user, i.e. "postgres", to the database called "postgres" (1st argument to psql). | |
# Set a password for the "postgres" database role using the command: | |
\password postgres |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pip | |
from subprocess import call | |
for dist in pip.get_installed_distributions(): | |
call("pip install --upgrade " + dist.project_name, shell=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add this to top of script with the correct path to your app | |
import sys, os | |
sys.path.append('/path/to/your/django/app') | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' | |
from django.conf import settings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "newprojectname", | |
"version": "1.0.0", | |
"description": "test-map", | |
"main": "main.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"build": "webpack --progress -p", | |
"watch": "webpack --progress --watch", | |
"server": "webpack-dev-server --open" |