Skip to content

Instantly share code, notes, and snippets.


Thomas Gratier ThomasG77

View GitHub Profile

Alternative to bundle with full projection support

Some people prefers using a full bundle Proj4js ( For server side, I like the approach but for client side, it bothers me to get the full bundle as I prefer loading on the fly the projection(s)

I made a short sample with two approaches (see comments in index.js). Code depends from availability from and related APIs

Recipe to try the sample

git clone load-proj4js-on-the-fly
import json
def csv_reader(file_name):
for row in open(file_name, "r"):
yield row
total = 0
for line in csv_reader("full.sjson"):
content = json.loads(line)
if 'housenumbers' in content:

Read nested element from GeoJSON and GDAL SQLite dialect

ogrinfo -dialect SQlite -sql "SELECT a_property, json_extract(some_object, '$.another_property') AS another_property, json_extract(some_object, '$.last_prop[1]') AS subarrayelement, geometry FROM demo" /tmp/demo.geojson

We use functions presented at to manipulate JSON in SQLite

View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>Display a map on a webpage</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<link href="" rel="stylesheet">
<script src=""></script>
body { margin: 0; padding: 0; }
QNetworkAccessManager in PyQt
In this example we get a web page.
Author: Jan Bodnar
import re
import urllib.request
from bs4 import BeautifulSoup
url = ''
urls = []
with urllib.request.urlopen(url) as f:
View report-http-broken.txt
├─BROKEN─ (HTTP_404)
├─BROKEN─ (HTTP_401)
├─BROKEN─ (HTTP_401)
├─BROKEN─ (HTTP_401)