I hereby claim:
- I am edwardbetts on github.
- I am edwardbetts (https://keybase.io/edwardbetts) on keybase.
- I have a public key whose fingerprint is FB8A CFA7 8C72 6089 C38A D026 9605 A109 8C63 B92A
To claim this, I am signing this object:
This is an example of how to locate Wikidata items from a SPARQL query on OpenStreetMap. | |
The overpass_query.py Python code will run a SPARQL query and use the results to generate an OSM Overpass query. | |
The name of a file containing a SPARQL query should be passed to overpass_query.py as the first command line argument. For example: | |
python overpass_query.py query.sparql | |
The query will find matching objects using the OSM wikidata tag. |
def getch(): | |
fd = sys.stdin.fileno() | |
old_settings = termios.tcgetattr(fd) | |
try: | |
tty.setraw(fd) | |
ch = sys.stdin.read(1) | |
except KeyboardInterrupt: | |
raise | |
finally: | |
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) |
from pprint import pformat | |
from typing import Any | |
from pygments import highlight | |
from pygments.formatters import Terminal256Formatter | |
from pygments.lexers import PythonLexer | |
def pprint_color(obj: Any) -> None: | |
"""Pretty-print in color.""" |
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
from urllib import quote_plus | |
from lxml import etree | |
def untruncate(s): | |
q = s.strip(u' .\u2026') | |
url = 'http://google.com/complete/search?output=toolbar&q=' + quote_plus(q.encode('latin-1')) | |
root = etree.parse(url).getroot() | |
return q + root[0][0].attrib['data'][len(q):] if len(root) else s | |
def demo(): |