from sqlalchemy import create_engine
import pandas as pd
#engine = create_engine('postgresql://osm@osmdb.eqiad.wmnet:5432/gis')
!pip install overpass
Collecting overpass
  Using cached overpass-0.5.6.tar.gz
Requirement already satisfied: requests>=2.3.0 in /srv/paws/lib/python3.4/site-packages (from overpass)
Collecting geojson>=1.0.9 (from overpass)
  Downloading geojson-1.3.4-py2.py3-none-any.whl
Installing collected packages: geojson, overpass
  Running setup.py install for overpass ... - \ done
Successfully installed geojson-1.3.4 overpass-0.5.6
import overpass
api = overpass.API()
response = api.Get('way["name"="Prager Straße"]')
len(response)
2
import json
import ipyleaflet as ll
import sys, os, time

map = ll.Map(center=[53.88,27.45], zoom=4)

#with open('./europe_110.geo.json') as f:
#    data = json.load(f)
data=response

for feature in data['features']:
    feature['properties']['style'] = {
        'color': 'red',
        'weight': 2,
        'fillColor': 'grey',
        'fillOpacity': 1.
    }

layer = ll.GeoJSON(data=data, hover_style={'fillColor': 'red'})

def hover_handler(event=None, id=None, properties=None):
    sys.stdout.write("\r" + properties['highway'])
    sys.stdout.flush()
    
layer.on_hover(hover_handler)
    
map.add_layer(layer)

map
primary
!pip install pg8000
Collecting pg8000
  Using cached pg8000-1.10.6-py2.py3-none-any.whl
Requirement already satisfied: six>=1.10.0 in /srv/paws/lib/python3.4/site-packages (from pg8000)
Installing collected packages: pg8000
Successfully installed pg8000-1.10.6
engine = create_engine('postgresql+pg8000://osm@osmdb.eqiad.wmnet:5432/gis')
df=pd.read_sql('Select * from planet_osm_line limit 3',engine)
df
osm_id access addr:housename addr:housenumber addr:interpolation admin_level aerialway aeroway amenity area ... tunnel water waterway wetland width wood z_order way_area tags way
0 240332775 None None None None None None None None yes ... None None None None None None 0 None "coastline"=>"bogus", "closure_segment"=>"yes" 0102000020110F000003000000A2306A44F81B73C13DC9...
1 -2186646 None None None None None None None None None ... None None None None None None 0 None "name:af"=>"Antarktika", "name:am"=>"አንታርክቲካ",... 0102000020110F0000040000000AD7A340F81B73C1B81E...
2 -3394113 None None None None None None None None None ... None None None None None None 0 None "name:af"=>"Ross-Afhanklikheid", "name:ar"=>"م... 0102000020110F0000040000000AD7A340F81B73C1B81E...

3 rows × 70 columns

#!pip install geopandas
Collecting geopandas
  Downloading geopandas-0.2.1-py2.py3-none-any.whl (199kB)
    100% |████████████████████████████████| 204kB 1.4MB/s 
Collecting fiona (from geopandas)
  Downloading Fiona-1.7.1-cp34-cp34m-manylinux1_x86_64.whl (39.6MB)
    100% |████████████████████████████████| 39.7MB 10kB/s 
Requirement already satisfied: pandas in /srv/paws/lib/python3.4/site-packages (from geopandas)
Collecting pyproj (from geopandas)
  Downloading pyproj-1.9.5.1.tar.gz (4.4MB)
    100% |████████████████████████████████| 4.4MB 92kB/s 
Collecting descartes (from geopandas)
  Downloading descartes-1.0.2-py3-none-any.whl
Collecting shapely (from geopandas)
  Downloading Shapely-1.5.17.tar.gz (180kB)
    100% |████████████████████████████████| 184kB 1.5MB/s 
    Complete output from command python setup.py egg_info:
    Failed `CDLL(libgeos_c.so.1)`
    Failed `CDLL(libgeos_c.so)`
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-lev8eyio/shapely/setup.py", line 38, in <module>
        from shapely._buildcfg import geos_version_string, geos_version, \
      File "/tmp/pip-build-lev8eyio/shapely/shapely/_buildcfg.py", line 167, in <module>
        fallbacks=['libgeos_c.so.1', 'libgeos_c.so'])
      File "/tmp/pip-build-lev8eyio/shapely/shapely/_buildcfg.py", line 161, in load_dll
        libname, fallbacks or []))
    OSError: Could not find library geos_c or load any of its variants ['libgeos_c.so.1', 'libgeos_c.so']
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-lev8eyio/shapely/