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 math | |
from xml.dom import minidom | |
def coord(way_id): | |
abs_file_path = "/Users/zia/Documents/Test/osm_road_length_data/itu_maslak.osm"; | |
xmldoc = minidom.parse(abs_file_path) | |
way = xmldoc.getElementsByTagName("way") | |
def node_coord(node_id): | |
node = xmldoc.getElementsByTagName("node") |
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 lxml import etree as et | |
from bz2file import BZ2File | |
from lxml.etree import tostring | |
path = "<path-to-osm.bz2-dir>/planet.osm.bz2" | |
path_nodes = "<path-to-osm.bz2-dir>/planet_nodes.osm" | |
str = ''; | |
with BZ2File(path) as xml_file: | |
with open(path_nodes, 'w') as f: |
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 xml.dom import minidom | |
from osgeo import ogr | |
import os, re | |
proj_dir = os.getcwd() | |
rel_file_path = "initial_osmfile.osm"; | |
abs_file_path = os.path.join(proj_dir, rel_file_path) | |
xmldoc = minidom.parse(abs_file_path) | |
node = xmldoc.getElementsByTagName("node") |
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 csv | |
from xml.dom import minidom | |
from osgeo import ogr | |
import os | |
from lxml.etree import tostring | |
# OSM data of Dar Es Salam can be downloaded from http://overpass.osm.rambler.ru/cgi/xapi_meta?*[bbox=39.0640,-7.1170,39.5269,-6.5767] | |
path_org = "<path to osm file>/planet.osm" | |
path_final = "<path to osm file>/planet_nodes.osm" | |
xmldoc = minidom.parse(path_org) |
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 csv | |
from xml.dom import minidom | |
from osgeo import ogr | |
import os, sys | |
abs_file_path = "<path_to_planet_osm_file>/planet.osm"; | |
xmldoc = minidom.parse(abs_file_path) | |
json_list = list() |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<osm version="0.6" generator="CGImap 0.0.2"> | |
<bounds minlat="54.0889580" minlon="12.2487570" maxlat="54.0913900" maxlon="12.2524800"/> | |
<node id="298884269" lat="54.0901746" lon="12.2482632" user="SvenHRO" uid="46882" visible="true" version="1" changeset="676636" timestamp="2008-09-21T21:37:45Z"/> | |
<node id="261728686" lat="54.0906309" lon="12.2441924" user="PikoWinter" uid="36744" visible="true" version="1" changeset="323878" timestamp="2008-05-03T13:39:23Z"/> | |
<node id="1831881213" version="1" changeset="12370172" lat="54.0900666" lon="12.2539381" user="lafkor" uid="75625" visible="true" timestamp="2012-07-20T09:43:19Z"> | |
<tag k="name" v="Neu Broderstorf"/> | |
<tag k="traffic_sign" v="city_limit"/> | |
</node> | |
<node id="298884272" lat="54.0901447" lon="12.2516513" user="SvenHRO" uid="46882" visible="true" version="1" changeset="676636" timestamp="2008-09-21T21:37:45Z"/> |
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
1. # Open cron command | |
sudo crontab -e | |
2. # Paste the following line at the very end to execute above script after every 5 min. | |
# More details about this at http://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/ | |
*/5 * * * * /usr/bin/python2.7 /var/www/html/maps/firemap/realdata-geojson/viirs/pullViirsData.py | |
3. # That's it. It will even run on system reboot. |
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 ftplib import FTP | |
import datetime, os, h5py, json | |
import matplotlib.pyplot as plt | |
import numpy as np | |
ftpUrl = 'ftp url' | |
user = 'username' | |
passwd = 'password' | |
basePath = 'seviri lsa path in 194 server' | |
baseFileName = 'name of seviri list product' |
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 os, time, csv, json | |
modisc6GlobalUrl = "modis c6 global csv url" | |
basePath = 'modis c6 basepath to 194 server' | |
baseFileName = 'modis c6 data base filename' | |
def createElemGeojson(latitude,longitude,brightness,scan,track,acq_date,acq_time,satellite,confidence,version,bright_t31,frp,daynight): | |
propValue = {} | |
propValue['BRIGHTNESS'] = float(brightness) | |
propValue['SCAN'] = float(scan) |
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 csv, psycopg2, operator | |
connection = psycopg2.connect("host='localhost' dbname='tpp_la_gridAAA' user='postgres' password='zia123'") | |
cursor1 = connection.cursor() | |
cursor2 = connection.cursor() | |
analysis = [{1:0},{2:0},{3:0},{4:0},{5:0},{6:0}] | |
sql = "select id from ways_vertices_pgr" | |
cursor1.execute(sql) |