Skip to content

Instantly share code, notes, and snippets.

View Zia-'s full-sized avatar
๐Ÿ™
I might be slow in response.

Mohammed Zia Zia-

๐Ÿ™
I might be slow in response.
View GitHub Profile
import os
from xml.dom import minidom
proj_dir = "/Users/zia/Documents/journals/My_WriteUp/Terrain_Routing_New/osm_data_downloaded/singaporeMalaysia/numberOfNodesPerRoad"
rel_file_path = "osm.osm";
abs_file_path = os.path.join(proj_dir, rel_file_path)
result_rel_file_path = "numberOfNodesPerRoad.csv"
result_abs_file_path = os.path.join(proj_dir, result_rel_file_path)
import osgeo.ogr
shapefile = osgeo.ogr.Open("/Users/zia/Documents/journals/My_WriteUp/pgr_TPP_5Algos/data/citySelection/majorCountriesCityShapefile/selectedworldcityshapes.shp")
layer = shapefile.GetLayer(0)
f = open("/Users/zia/Documents/journals/My_WriteUp/pgr_TPP_5Algos/data/citySelection/testCode/osmCityDownloadLinks.txt", 'w')
for i in range(layer.GetFeatureCount()):
feature = layer.GetFeature(i)
"======== Custom Mapping ========
"general mapping
nmap <C-Tab> :tabnext<CR>
nmap <C-S-Tab> :tabprevious<CR>
map <C-S-Tab> :tabprevious<CR>
map <C-Tab> :tabnext<CR>
imap <C-S-Tab> <ESC> : tabprevious<CR>
imap <C-Tab> <ESC> : tabnext<CR>
noremap <F7> :set expandtab!<CR>
-- The following should be OK
select pgr_labelGraph('ways');
select pgr_labelGraph('Ways');
select pgr_labelGraph('ways', 'id');
select pgr_labelGraph('ways', 'id', 'source');
select pgr_labelGraph('ways', 'id', 'source', 'target');
select pgr_labelGraph('ways', 'id', 'source', 'target', 'subgraph');
select pgr_labelGraph('ways', 'id', 'source', 'target', 'subgraph', 'id<100');
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NamedLayer>
<Name>point_bank</Name>
<UserStyle>
<Title>bank point style</Title>
@Zia-
Zia- / Terminal Commands
Last active May 15, 2017 07:48
Terminal Commands useful on a daily basis
1. Trim terminal path:
PS1='\u:\W\$ '
OR
PS1='\W\$ '
2. Go to previous directory:
cd -
3. Kill Port process and free it:
sudo lsof -i :3000
import os, time, datetime, sys
##### Usage:
# python script.py A B C D E F
# A = X start
# B = X end
# C = Y start
# D = Y end
# E = traffic Dir parent path
# F = wgetList1.txt, i.e. wget List file name. This will keep on updating in each while loop
@Zia-
Zia- / downloadOSM.html
Created August 14, 2018 13:41
Download OSM Data from rectangle draw with different baselayers.
<!DOCTYPE html>
<html>
<head>
<title>Download OSM File from rectangle drag</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
import grequests, requests, time
then = time.time()
urls = [
'https://api.ohsome.org/v0.9/elements/geometry?bboxes=8.625%2C49.3711%2C8.7334%2C49.4397&properties=tags&showMetadata=false&time=2014-01-01%2C2017-01-01&types=way',
'https://api.ohsome.org/v0.9/elements/geometry?bboxes=8.625%2C49.3711%2C8.7334%2C49.4397&properties=tags&showMetadata=false&time=2014-01-01%2C2017-01-01&types=way',
'https://api.ohsome.org/v0.9/elements/geometry?bboxes=8.625%2C49.3711%2C8.7334%2C49.4397&properties=tags&showMetadata=false&time=2014-01-01%2C2017-01-01&types=way'
]
@Zia-
Zia- / Cheat Code
Last active April 4, 2022 17:11
Docker commands
// Docker
- Kill/Stop all containers -
docker kill $(docker ps -q)
- Delete all containers -
docker rm $(docker ps -a -q)
- Delete all images -
docker rmi $(docker images -q)