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
#!/bin/bash | |
# To execute in batch mode | |
# find . -iname "*.dwg" -print0 | xargs -0 -I {} ./sh-dwgtodxf.sh -i "{}" | |
TEIGHA="/Applications/TeighaFileConverter.app/Contents/MacOS/TeighaFileConverter" | |
OUTVER="ACAD2004" | |
OUTFORMAT="DXF" | |
RECURSIVE="0" | |
AUDIT="1" |
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
#!/bin/bash | |
# Find all dxf recursively and upload to Postgresql+Postgis database, using ogr2ogr | |
find . -iname "*.dxf" -print0 | xargs -0 -I {} ogr2ogr --config OGR_ENABLE_PARTIAL_REPROJECTION TRUE --config CPL_DEBUG ON -f "PostgreSQL" PG:"dbname=mapDatabase user=postgres" "{}" -s_srs "+proj=sterea +lat_0=34.2 +lon_0=39.15 +x_0=28 +y_0=-42 +a=6378249.2 +b=6356515 +units=m +no_defs" -t_srs EPSG:4326 -a_srs EPSG:4326 -dim XY -dialect SQLITE -sql "SELECT e.layer, e.text, e.geometry FROM entities e WHERE ST_GeometryType(e.geometry) IN ('POINT', 'POINT Z', 'LINESTRING', 'LINESTRING Z', 'MULTILINESTRING', 'MULTILINESTRING Z', 'POLYGON', 'POLYGON Z', 'MULTIPOLYGON', 'MULTIPOLYGON Z');" -nln 'entities' -append |
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
#!/bin/bash | |
# Check geometry types in files, counts number of features. Using ogrinfo, can take dxf, geosjon and more | |
ogrinfo -dialect SQLITE -sql "SELECT ST_GeometryType(geometry), COUNT(ST_GeometryType(geometry)) FROM entities e GROUP BY ST_GeometryType(geometry);" input.dxf |
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
from json import load, JSONEncoder | |
from optparse import OptionParser | |
from re import compile | |
float_pat = compile(r'^-?\d+\.\d+(e-?\d+)?$') | |
charfloat_pat = compile(r'^[\[,\,]-?\d+\.\d+(e-?\d+)?$') | |
parser = OptionParser(usage="""%prog [options] | |
Group multiple GeoJSON files into one output file. |
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
#!/bin/bash | |
# Merge accepted files into one geojson using ogr2ogr. Supports DXF 2004 and later, Geojson and more | |
# http://www.gdal.org/ogr_formats.html | |
# This is a bit slow, but npm install geojson-merge seems to have trouble with big files | |
# Includes option to enable partial reprojection, dropping invalid coordinates, and also reprojects with custom PROJ.4 string | |
# Drops Z axis using -dim XY, but accepts Z axis features. | |
for f in *.dxf | |
do |
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
/* overpass-turbo: Find all boundaries for Lebanon on admin_level 4 */ | |
{{geocodeArea:"LB"}}->.a; | |
( | |
relation["boundary"="administrative"]["admin_level"="4"](area.a); | |
); | |
/*added by auto repair*/ | |
(._;>;); | |
/*end of auto repair*/ | |
out; |
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
#!/bin/bash | |
# Script to setup an Elastic Beanstalk AMI with geospatial libraries and postGIS, extra python3 | |
# Stable releases as of 15. January 2018 | |
# Go to ec2-user home directory | |
cd /home/ec2-user | |
sudo yum -y install gcc gcc-c++ make cmake libtool libcurl-devel libxml2-devel rubygems swig fcgi-devel\ | |
libtiff-devel freetype-devel curl-devel libpng-devel giflib-devel libjpeg-devel\ | |
cairo-devel freetype-devel readline-devel openssl-devel python27 python27-devel\ |
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
#!/usr/bin/env python | |
# http://vislab-ccom.unh.edu/~schwehr/rt/python-binary-files.html | |
# https://knowledge.autodesk.com/support/autocad/learn-explore/caas/sfdcarticles/sfdcarticles/drawing-version-codes-for-autocad.html | |
# MC0.0 - DWG Release 1.1 | |
# AC1.2 - DWG Release 1.2 | |
# AC1.4 - DWG Release 1.4 | |
# AC1.50 - DWG Release 2.0 | |
# AC2.10 - DWG Release 2.10 | |
# AC1002 - DWG Release 2.5 |
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
#!/usr/bin/env python3 | |
import requests | |
from pprint import pprint | |
client_id = r'REPLACEME' #Application key | |
client_secret = r'REPLACEME' #Client key | |
oauth_token_base_url = 'https://godemo.poweroffice.net/OAuth/Token' | |
api_base_url = 'https://api-demo.poweroffice.net/' | |
def _url(path): |
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
SUBSYSTEM=="meson-gpiomem", KERNEL=="gpiomem", GROUP="gpio", MODE="0660" | |
SUBSYSTEM=="gpio", KERNEL=="gpiochip*", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:gpio /sys/class/gpio/export /sys/class/gpio/unexport ; chmod 220 /sys/class/gpio/export /sys/class/gpio/unexport'" | |
SUBSYSTEM=="gpio", KERNEL=="gpio*", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:gpio /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value ; chmod 660 /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value'" |
NewerOlder