SlideShare uma empresa Scribd logo
1 de 43
Baixar para ler offline
GIS, Python and company

    Igor Pochechuev
    22-23 October, 2011
    Kyiv, Ukraine
Content
●   What is geometry?
    geometry formats
●   How to store geo data?
    spatial databases
●   Where we can get geo data?
●   Render it!
●   Demo
General provisions
     what we got
Geometry
                       formats

●   WKT, WKB
●   KML, GML (xml based)
●   GeoJSON (json based)
●   Shapefile (ESRI open specification)
●   etc.
Geometry
                     common types

●   Point
    (x, y)
●   Line
    (<point>, <point1>, <point2>, …)
●   Polygon
    (<line>, <line1>, <line2>, …)
MultiGeometry
                 additional types of geometry

●   MultiPoint
    (<point>, <point1>, <point2>, ...)
●   MultiLine
    (<line>, <line1>, <line2>, ...)
●   MultiPolygon
    (<polygon>, <polygon1>, <polygon2>, ...)
Database layer
  storing spatial data
Storing data
                     spatial databases
●   SpatiaLite (SQLite)
●   MySQL
●   Oracle
●   PostGIS (PostgreSQL)
Storing data
   right choice




PostGIS
How to get geo data?
      vector data
Getting data
     vector data


OpenStreetMap
OpenStreetMap
                              stats

●   < 400 000 registered users
●   ~ 1 100 000 000 nodes (points)
●   100 000 000 ways
●   ~ 800 — 3 000 nodes added each day
●   ~ 100 000 — 300 000 ways added each day
●   More statistics:
    http://wiki.openstreetmap.org/wiki/Stats
OpenStreetMap
                              downloading ...

●   Download planet.osm
    http://wiki.openstreetmap.org/wiki/Planet.osm
●   OSM API
    http://api.openstreetmap.org/api/0.6/map?bbox=11.54,48.14,11.543,48.145

●   JOSM (download through desktop app)
    http://wiki.openstreetmap.org/wiki/JOSM
●   Third part services (GIS LAB)
    http://gis-lab.info/projects/osm-export.html
Loading data to database
>wget http://wiki.openstreetmap.org/wiki/Planet.osm
OSM2PgSQL
                                    loading data

●   osm2pgsql
    -d <db_name>
    -H <db_host>
    -U <db_user>
    -P <db_port>
    -c # create tables if needed
    -s # store tmp data in database
    -S osm.import.style # mapping style
    -k # add tags without column to an additional hstore
    -z extra_data # hstore column containing all tags that start with 'extra_data'
    RU-KRS.osm # path to OSM data file
Rendering ...
Rendering
             tool choosing




MapServer                    Mapnik
Mapnik
                       description

●   Written in C++
●   Python interface
●   OpenStreetMap, Flickr, CloudMade use mapnik
●   PostGIS, Shapefiles, GeoTIFF, OSM XML, ...
●   PNG, JPG, SVG, PDF, ...
Mapnik
map example
Layers
 intro
Mapnik
                                  code example

import mapnik

m = mapnik.Map(600,300,"+proj=latlong +datum=WGS84")
m.background = mapnik.Color('steelblue')

r = mapnik.Rule()
r.symbols.append(mapnik.PolygonSymbolizer(mapnik.Color('#f2eff9')))
r.symbols.append(mapnik.LineSymbolizer(mapnik.Color('rgb(50%,50%,50%)'),0.1))

s = mapnik.Style()
s.rules.append(r)
m.append_style('World Style',s)
Mapnik
                                  code example

import mapnik

m = mapnik.Map(600, 300, "+proj=latlong +datum=WGS84")
m.background = mapnik.Color('steelblue')

r = mapnik.Rule()
r.symbols.append(mapnik.PolygonSymbolizer(mapnik.Color('#f2eff9')))
r.symbols.append(mapnik.LineSymbolizer(mapnik.Color('rgb(50%,50%,50%)'),0.1))

s = mapnik.Style()
s.rules.append(r)
m.append_style('World Style',s)
Mapnik
                                  code example

import mapnik

m = mapnik.Map(600, 300, "+proj=latlong +datum=WGS84")
m.background = mapnik.Color('steelblue')

r = mapnik.Rule()
r.symbols.append(mapnik.PolygonSymbolizer(mapnik.Color('#f2eff9')))
r.symbols.append(mapnik.LineSymbolizer(mapnik.Color('rgb(50%,50%,50%)'), 0.1))

s = mapnik.Style()
s.rules.append(r)
m.append_style('World Style',s)
Mapnik
                                  code example

import mapnik

m = mapnik.Map(600, 300, "+proj=latlong +datum=WGS84")
m.background = mapnik.Color('steelblue')

r = mapnik.Rule()
r.symbols.append(mapnik.PolygonSymbolizer(mapnik.Color('#f2eff9')))
r.symbols.append(mapnik.LineSymbolizer(mapnik.Color('rgb(50%,50%,50%)'), 0.1))

s = mapnik.Style()
s.rules.append(r)
m.append_style('World Style',s)
Mapnik
                             code example 2

lyr = mapnik.Layer('world', "+proj=latlong +datum=WGS84")

lyr.datasource = mapnik.Shapefile(file='world_borders.shp')

lyr.styles.append('World Style')

m.layers.append(lyr)

m.zoom_to_box(lyr.envelope())

mapnik.render_to_file(m,'world.png', 'png')
Mapnik
                             code example 2

lyr = mapnik.Layer('world', "+proj=latlong +datum=WGS84")

lyr.datasource = mapnik.Shapefile(file='world_borders.shp')

lyr.styles.append('World Style')

m.layers.append(lyr)

m.zoom_to_box(lyr.envelope())

mapnik.render_to_file(m,'world.png', 'png')
Mapnik
                             code example 2

lyr = mapnik.Layer('world', "+proj=latlong +datum=WGS84")

lyr.datasource = mapnik.Shapefile(file='world_borders.shp')

lyr.styles.append('World Style')

m.layers.append(lyr)

m.zoom_to_box(lyr.envelope())

mapnik.render_to_file(m,'world.png', 'png')
Map in browser
Mapnik
tile description
Mapnik
                       map services

●   Tile Map Service
●   Web Map Service
Mapnik
                    TMS

http: //website.com/<zoom>/<x>/<y>.png

../tiles/12/2451/1360.png
Mapnik
                             using osm scripts

●   svn export http://svn.openstreetmap.org/applications/rendering/...
●   ./generate_xml.py --password 'value' --host 'value' --port 'value'
    --user 'value' --dbname 'value'
●   MAPNIK_MAP_FILE='osm.xml' MAPNIK_TILE_DIR='tiles/'
    ./generate_tiles.py
Mapnik XML
<Map bgcolor="#b5d0d0">
<Style name="map_style">
   <Rule>
       <MaxScaleDenominator>[scale]</MaxScaleDenominator>
       <MinScaleDenominator>[scale]</MinScaleDenominator>
       <Filter>[field]='value'</Filter>
       <PointSymbolizer/>
       <LineSymbolizer/>
       <PolygonSymbolizer/>
       …
   </Rule>
</Style>
Mapnik XML
<Layer name="misc_boundaries">

<StyleName>map_style</StyleName>
<Datasource>
   <Parameter name="table">
       (select way,way_area,name,boundary from polygon
       where boundary='national_park') as boundary
   </Parameter>
   <Parameter name='dbname'>[dbname]</Parameter>
   <Parameter name='host'>[host]</Parameter>
   <Parameter name='user'>[user]</Parameter>
   …
</Datasource>
</Layer>
Tile generating



./generate_tiles.py
Got tiles, what's next?
Frontend maps
                    choosing tool

●   OpenLayers
●   GeoExt
●   Leaflet
OpenLayers
●   Most powerfull
●   Most used
●   Large community
●   OSM supported
●   OSM, Google, Yahoo maps in one string
●   TMS, WMS, WFS
●   GML, GeoJSON, GeoRSS
OpenLayers
Show time!
Thanks!
Questions?

Mais conteúdo relacionado

Mais procurados

Server side geo_tools_in_drupal_pnw_2012
Server side geo_tools_in_drupal_pnw_2012Server side geo_tools_in_drupal_pnw_2012
Server side geo_tools_in_drupal_pnw_2012Mack Hardy
 
OSM data in MariaDB / MySQL - All the world in a few large tables
OSM data in MariaDB / MySQL - All the world in a few large tablesOSM data in MariaDB / MySQL - All the world in a few large tables
OSM data in MariaDB / MySQL - All the world in a few large tableshholzgra
 
Having fun with graphs, a short introduction to D3.js
Having fun with graphs, a short introduction to D3.jsHaving fun with graphs, a short introduction to D3.js
Having fun with graphs, a short introduction to D3.jsMichael Hackstein
 
3D + MongoDB = 3D Repo
3D + MongoDB = 3D Repo3D + MongoDB = 3D Repo
3D + MongoDB = 3D RepoMongoDB
 
Spatial functions in MySQL 5.6, MariaDB 5.5, PostGIS 2.0 and others
Spatial functions in  MySQL 5.6, MariaDB 5.5, PostGIS 2.0 and othersSpatial functions in  MySQL 5.6, MariaDB 5.5, PostGIS 2.0 and others
Spatial functions in MySQL 5.6, MariaDB 5.5, PostGIS 2.0 and othersHenrik Ingo
 
Grails : Ordr, Maps & Charts
Grails : Ordr, Maps & ChartsGrails : Ordr, Maps & Charts
Grails : Ordr, Maps & ChartsHenk Jurriens
 
Scala meetup - Intro to spark
Scala meetup - Intro to sparkScala meetup - Intro to spark
Scala meetup - Intro to sparkJavier Arrieta
 
Introduction To PostGIS
Introduction To PostGISIntroduction To PostGIS
Introduction To PostGISmleslie
 
MongoDB GeoSpatial Feature
MongoDB GeoSpatial FeatureMongoDB GeoSpatial Feature
MongoDB GeoSpatial FeatureHüseyin BABAL
 
Geospatial and MongoDB
Geospatial and MongoDBGeospatial and MongoDB
Geospatial and MongoDBNorberto Leite
 
Advanced Data Visualization in R- Somes Examples.
Advanced Data Visualization in R- Somes Examples.Advanced Data Visualization in R- Somes Examples.
Advanced Data Visualization in R- Somes Examples.Dr. Volkan OBAN
 
Html5 canvas
Html5 canvasHtml5 canvas
Html5 canvasGary Yeh
 
Transforming public data into thematic maps (TDC2019 presentation)
Transforming public data into thematic maps (TDC2019 presentation)Transforming public data into thematic maps (TDC2019 presentation)
Transforming public data into thematic maps (TDC2019 presentation)Helder da Rocha
 
Gems of GameplayKit. UA Mobile 2017.
Gems of GameplayKit. UA Mobile 2017.Gems of GameplayKit. UA Mobile 2017.
Gems of GameplayKit. UA Mobile 2017.UA Mobile
 

Mais procurados (20)

Server side geo_tools_in_drupal_pnw_2012
Server side geo_tools_in_drupal_pnw_2012Server side geo_tools_in_drupal_pnw_2012
Server side geo_tools_in_drupal_pnw_2012
 
OSM data in MariaDB / MySQL - All the world in a few large tables
OSM data in MariaDB / MySQL - All the world in a few large tablesOSM data in MariaDB / MySQL - All the world in a few large tables
OSM data in MariaDB / MySQL - All the world in a few large tables
 
Having fun with graphs, a short introduction to D3.js
Having fun with graphs, a short introduction to D3.jsHaving fun with graphs, a short introduction to D3.js
Having fun with graphs, a short introduction to D3.js
 
3D + MongoDB = 3D Repo
3D + MongoDB = 3D Repo3D + MongoDB = 3D Repo
3D + MongoDB = 3D Repo
 
Spatial functions in MySQL 5.6, MariaDB 5.5, PostGIS 2.0 and others
Spatial functions in  MySQL 5.6, MariaDB 5.5, PostGIS 2.0 and othersSpatial functions in  MySQL 5.6, MariaDB 5.5, PostGIS 2.0 and others
Spatial functions in MySQL 5.6, MariaDB 5.5, PostGIS 2.0 and others
 
Logging in JavaScript - Part-3
Logging in JavaScript - Part-3Logging in JavaScript - Part-3
Logging in JavaScript - Part-3
 
Grails : Ordr, Maps & Charts
Grails : Ordr, Maps & ChartsGrails : Ordr, Maps & Charts
Grails : Ordr, Maps & Charts
 
Day 6 - PostGIS
Day 6 - PostGISDay 6 - PostGIS
Day 6 - PostGIS
 
Scala meetup - Intro to spark
Scala meetup - Intro to sparkScala meetup - Intro to spark
Scala meetup - Intro to spark
 
Introduction To PostGIS
Introduction To PostGISIntroduction To PostGIS
Introduction To PostGIS
 
MongoDB GeoSpatial Feature
MongoDB GeoSpatial FeatureMongoDB GeoSpatial Feature
MongoDB GeoSpatial Feature
 
Geospatial and MongoDB
Geospatial and MongoDBGeospatial and MongoDB
Geospatial and MongoDB
 
Advanced Data Visualization in R- Somes Examples.
Advanced Data Visualization in R- Somes Examples.Advanced Data Visualization in R- Somes Examples.
Advanced Data Visualization in R- Somes Examples.
 
d3 is cool
d3 is coold3 is cool
d3 is cool
 
Intro to HTML5 Canvas
Intro to HTML5 CanvasIntro to HTML5 Canvas
Intro to HTML5 Canvas
 
Html5 canvas
Html5 canvasHtml5 canvas
Html5 canvas
 
Transforming public data into thematic maps (TDC2019 presentation)
Transforming public data into thematic maps (TDC2019 presentation)Transforming public data into thematic maps (TDC2019 presentation)
Transforming public data into thematic maps (TDC2019 presentation)
 
Gems of GameplayKit. UA Mobile 2017.
Gems of GameplayKit. UA Mobile 2017.Gems of GameplayKit. UA Mobile 2017.
Gems of GameplayKit. UA Mobile 2017.
 
Efek daun
Efek daunEfek daun
Efek daun
 
Snow
SnowSnow
Snow
 

Destaque

Grace Photo Show
Grace  Photo ShowGrace  Photo Show
Grace Photo Showdabeaty
 
HotelToWeb
HotelToWebHotelToWeb
HotelToWebdidemc
 
HTWRateHunter
HTWRateHunterHTWRateHunter
HTWRateHunterdidemc
 
Hotel To Web Katalog
Hotel To Web KatalogHotel To Web Katalog
Hotel To Web Katalogdidemc
 
Nj 09 Q4 Paul Kadzielawa
Nj 09 Q4 Paul KadzielawaNj 09 Q4 Paul Kadzielawa
Nj 09 Q4 Paul KadzielawaPKadzielawa
 
ภารกิจ การจัด และการดำเนินงานทางทหาร สำหรับบรรยายมหาลัย
ภารกิจ การจัด และการดำเนินงานทางทหาร สำหรับบรรยายมหาลัยภารกิจ การจัด และการดำเนินงานทางทหาร สำหรับบรรยายมหาลัย
ภารกิจ การจัด และการดำเนินงานทางทหาร สำหรับบรรยายมหาลัยminiindy
 
GeoDjango in a nutshell
GeoDjango in a nutshellGeoDjango in a nutshell
GeoDjango in a nutshellDjango Stars
 
หลักการสงคราม
หลักการสงครามหลักการสงคราม
หลักการสงครามminiindy
 
ภารกิจ+กา..
ภารกิจ+กา..ภารกิจ+กา..
ภารกิจ+กา..miniindy
 
ทบทวนวิชา..
ทบทวนวิชา..ทบทวนวิชา..
ทบทวนวิชา..miniindy
 
สรุปเนื้อหาวิชาการทหารกองทัพเรือ
สรุปเนื้อหาวิชาการทหารกองทัพเรือสรุปเนื้อหาวิชาการทหารกองทัพเรือ
สรุปเนื้อหาวิชาการทหารกองทัพเรือminiindy
 
HotelToWeb Catalogue
HotelToWeb CatalogueHotelToWeb Catalogue
HotelToWeb Cataloguedidemc
 
WHY gowellgo
WHY gowellgoWHY gowellgo
WHY gowellgodidemc
 
ABOUT gowellgo
ABOUT gowellgoABOUT gowellgo
ABOUT gowellgodidemc
 
HotelToWeb
HotelToWebHotelToWeb
HotelToWebdidemc
 
ความสัมพันธ์ ผบ.
ความสัมพันธ์ ผบ.ความสัมพันธ์ ผบ.
ความสัมพันธ์ ผบ.miniindy
 
ทบทวนวิชาวิทยาการทหาร51
ทบทวนวิชาวิทยาการทหาร51ทบทวนวิชาวิทยาการทหาร51
ทบทวนวิชาวิทยาการทหาร51miniindy
 

Destaque (20)

Grace Photo Show
Grace  Photo ShowGrace  Photo Show
Grace Photo Show
 
HotelToWeb
HotelToWebHotelToWeb
HotelToWeb
 
CSC Screeding
CSC ScreedingCSC Screeding
CSC Screeding
 
HTWRateHunter
HTWRateHunterHTWRateHunter
HTWRateHunter
 
Hotel To Web Katalog
Hotel To Web KatalogHotel To Web Katalog
Hotel To Web Katalog
 
Vœux 2010 de la Mairie
Vœux 2010 de la MairieVœux 2010 de la Mairie
Vœux 2010 de la Mairie
 
Nj 09 Q4 Paul Kadzielawa
Nj 09 Q4 Paul KadzielawaNj 09 Q4 Paul Kadzielawa
Nj 09 Q4 Paul Kadzielawa
 
ภารกิจ การจัด และการดำเนินงานทางทหาร สำหรับบรรยายมหาลัย
ภารกิจ การจัด และการดำเนินงานทางทหาร สำหรับบรรยายมหาลัยภารกิจ การจัด และการดำเนินงานทางทหาร สำหรับบรรยายมหาลัย
ภารกิจ การจัด และการดำเนินงานทางทหาร สำหรับบรรยายมหาลัย
 
GeoDjango in a nutshell
GeoDjango in a nutshellGeoDjango in a nutshell
GeoDjango in a nutshell
 
I P I A L E S
I P I A L E SI P I A L E S
I P I A L E S
 
หลักการสงคราม
หลักการสงครามหลักการสงคราม
หลักการสงคราม
 
ภารกิจ+กา..
ภารกิจ+กา..ภารกิจ+กา..
ภารกิจ+กา..
 
ทบทวนวิชา..
ทบทวนวิชา..ทบทวนวิชา..
ทบทวนวิชา..
 
สรุปเนื้อหาวิชาการทหารกองทัพเรือ
สรุปเนื้อหาวิชาการทหารกองทัพเรือสรุปเนื้อหาวิชาการทหารกองทัพเรือ
สรุปเนื้อหาวิชาการทหารกองทัพเรือ
 
HotelToWeb Catalogue
HotelToWeb CatalogueHotelToWeb Catalogue
HotelToWeb Catalogue
 
WHY gowellgo
WHY gowellgoWHY gowellgo
WHY gowellgo
 
ABOUT gowellgo
ABOUT gowellgoABOUT gowellgo
ABOUT gowellgo
 
HotelToWeb
HotelToWebHotelToWeb
HotelToWeb
 
ความสัมพันธ์ ผบ.
ความสัมพันธ์ ผบ.ความสัมพันธ์ ผบ.
ความสัมพันธ์ ผบ.
 
ทบทวนวิชาวิทยาการทหาร51
ทบทวนวิชาวิทยาการทหาร51ทบทวนวิชาวิทยาการทหาร51
ทบทวนวิชาวิทยาการทหาร51
 

Semelhante a Pycon2011

Python en la Plataforma ArcGIS
Python en la Plataforma ArcGISPython en la Plataforma ArcGIS
Python en la Plataforma ArcGISXander Bakker
 
State of the Art Web Mapping with Open Source
State of the Art Web Mapping with Open SourceState of the Art Web Mapping with Open Source
State of the Art Web Mapping with Open SourceOSCON Byrum
 
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...Chester Chen
 
FOSS4G 2010 PostGIS Raster: an Open Source alternative to Oracle GeoRaster
FOSS4G 2010 PostGIS Raster: an Open Source alternative to Oracle GeoRasterFOSS4G 2010 PostGIS Raster: an Open Source alternative to Oracle GeoRaster
FOSS4G 2010 PostGIS Raster: an Open Source alternative to Oracle GeoRasterJorge Arevalo
 
2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locator2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locatorAlberto Paro
 
2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locator2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locatorAlberto Paro
 
What are customers building with new Bing Maps capabilities
What are customers building with new Bing Maps capabilitiesWhat are customers building with new Bing Maps capabilities
What are customers building with new Bing Maps capabilitiesMicrosoft Tech Community
 
How to separate frontend from a highload python project with no problems - Py...
How to separate frontend from a highload python project with no problems - Py...How to separate frontend from a highload python project with no problems - Py...
How to separate frontend from a highload python project with no problems - Py...Oleksandr Tarasenko
 
Sapo GIS Hands-On
Sapo GIS Hands-OnSapo GIS Hands-On
Sapo GIS Hands-Oncodebits
 
Gis SAPO Hands On
Gis SAPO Hands OnGis SAPO Hands On
Gis SAPO Hands Oncodebits
 
Social Data and Log Analysis Using MongoDB
Social Data and Log Analysis Using MongoDBSocial Data and Log Analysis Using MongoDB
Social Data and Log Analysis Using MongoDBTakahiro Inoue
 
Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece
Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece
Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece CoLab Athens
 
R getting spatial
R getting spatialR getting spatial
R getting spatialFAO
 
Geo script opengeo spring 2013
Geo script opengeo spring 2013Geo script opengeo spring 2013
Geo script opengeo spring 2013Ilya Rosenfeld
 
D3 Mapping Visualization
D3 Mapping VisualizationD3 Mapping Visualization
D3 Mapping VisualizationSudhir Chowbina
 
How to Hack a Road Trip with a Webcam, a GSP and Some Fun with Node
How to Hack a Road Trip  with a Webcam, a GSP and Some Fun with NodeHow to Hack a Road Trip  with a Webcam, a GSP and Some Fun with Node
How to Hack a Road Trip with a Webcam, a GSP and Some Fun with Nodepdeschen
 
Graph computation
Graph computationGraph computation
Graph computationSigmoid
 
Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs偉格 高
 
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseCodepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseSages
 

Semelhante a Pycon2011 (20)

Python en la Plataforma ArcGIS
Python en la Plataforma ArcGISPython en la Plataforma ArcGIS
Python en la Plataforma ArcGIS
 
State of the Art Web Mapping with Open Source
State of the Art Web Mapping with Open SourceState of the Art Web Mapping with Open Source
State of the Art Web Mapping with Open Source
 
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
 
FOSS4G 2010 PostGIS Raster: an Open Source alternative to Oracle GeoRaster
FOSS4G 2010 PostGIS Raster: an Open Source alternative to Oracle GeoRasterFOSS4G 2010 PostGIS Raster: an Open Source alternative to Oracle GeoRaster
FOSS4G 2010 PostGIS Raster: an Open Source alternative to Oracle GeoRaster
 
2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locator2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locator
 
2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locator2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locator
 
10. R getting spatial
10.  R getting spatial10.  R getting spatial
10. R getting spatial
 
What are customers building with new Bing Maps capabilities
What are customers building with new Bing Maps capabilitiesWhat are customers building with new Bing Maps capabilities
What are customers building with new Bing Maps capabilities
 
How to separate frontend from a highload python project with no problems - Py...
How to separate frontend from a highload python project with no problems - Py...How to separate frontend from a highload python project with no problems - Py...
How to separate frontend from a highload python project with no problems - Py...
 
Sapo GIS Hands-On
Sapo GIS Hands-OnSapo GIS Hands-On
Sapo GIS Hands-On
 
Gis SAPO Hands On
Gis SAPO Hands OnGis SAPO Hands On
Gis SAPO Hands On
 
Social Data and Log Analysis Using MongoDB
Social Data and Log Analysis Using MongoDBSocial Data and Log Analysis Using MongoDB
Social Data and Log Analysis Using MongoDB
 
Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece
Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece
Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece
 
R getting spatial
R getting spatialR getting spatial
R getting spatial
 
Geo script opengeo spring 2013
Geo script opengeo spring 2013Geo script opengeo spring 2013
Geo script opengeo spring 2013
 
D3 Mapping Visualization
D3 Mapping VisualizationD3 Mapping Visualization
D3 Mapping Visualization
 
How to Hack a Road Trip with a Webcam, a GSP and Some Fun with Node
How to Hack a Road Trip  with a Webcam, a GSP and Some Fun with NodeHow to Hack a Road Trip  with a Webcam, a GSP and Some Fun with Node
How to Hack a Road Trip with a Webcam, a GSP and Some Fun with Node
 
Graph computation
Graph computationGraph computation
Graph computation
 
Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs
 
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseCodepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
 

Último

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Último (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

Pycon2011

  • 1. GIS, Python and company Igor Pochechuev 22-23 October, 2011 Kyiv, Ukraine
  • 2.
  • 3. Content ● What is geometry? geometry formats ● How to store geo data? spatial databases ● Where we can get geo data? ● Render it! ● Demo
  • 4. General provisions what we got
  • 5. Geometry formats ● WKT, WKB ● KML, GML (xml based) ● GeoJSON (json based) ● Shapefile (ESRI open specification) ● etc.
  • 6. Geometry common types ● Point (x, y) ● Line (<point>, <point1>, <point2>, …) ● Polygon (<line>, <line1>, <line2>, …)
  • 7. MultiGeometry additional types of geometry ● MultiPoint (<point>, <point1>, <point2>, ...) ● MultiLine (<line>, <line1>, <line2>, ...) ● MultiPolygon (<polygon>, <polygon1>, <polygon2>, ...)
  • 8. Database layer storing spatial data
  • 9. Storing data spatial databases ● SpatiaLite (SQLite) ● MySQL ● Oracle ● PostGIS (PostgreSQL)
  • 10. Storing data right choice PostGIS
  • 11. How to get geo data? vector data
  • 12. Getting data vector data OpenStreetMap
  • 13. OpenStreetMap stats ● < 400 000 registered users ● ~ 1 100 000 000 nodes (points) ● 100 000 000 ways ● ~ 800 — 3 000 nodes added each day ● ~ 100 000 — 300 000 ways added each day ● More statistics: http://wiki.openstreetmap.org/wiki/Stats
  • 14. OpenStreetMap downloading ... ● Download planet.osm http://wiki.openstreetmap.org/wiki/Planet.osm ● OSM API http://api.openstreetmap.org/api/0.6/map?bbox=11.54,48.14,11.543,48.145 ● JOSM (download through desktop app) http://wiki.openstreetmap.org/wiki/JOSM ● Third part services (GIS LAB) http://gis-lab.info/projects/osm-export.html
  • 15. Loading data to database
  • 17. OSM2PgSQL loading data ● osm2pgsql -d <db_name> -H <db_host> -U <db_user> -P <db_port> -c # create tables if needed -s # store tmp data in database -S osm.import.style # mapping style -k # add tags without column to an additional hstore -z extra_data # hstore column containing all tags that start with 'extra_data' RU-KRS.osm # path to OSM data file
  • 19. Rendering tool choosing MapServer Mapnik
  • 20. Mapnik description ● Written in C++ ● Python interface ● OpenStreetMap, Flickr, CloudMade use mapnik ● PostGIS, Shapefiles, GeoTIFF, OSM XML, ... ● PNG, JPG, SVG, PDF, ...
  • 23. Mapnik code example import mapnik m = mapnik.Map(600,300,"+proj=latlong +datum=WGS84") m.background = mapnik.Color('steelblue') r = mapnik.Rule() r.symbols.append(mapnik.PolygonSymbolizer(mapnik.Color('#f2eff9'))) r.symbols.append(mapnik.LineSymbolizer(mapnik.Color('rgb(50%,50%,50%)'),0.1)) s = mapnik.Style() s.rules.append(r) m.append_style('World Style',s)
  • 24. Mapnik code example import mapnik m = mapnik.Map(600, 300, "+proj=latlong +datum=WGS84") m.background = mapnik.Color('steelblue') r = mapnik.Rule() r.symbols.append(mapnik.PolygonSymbolizer(mapnik.Color('#f2eff9'))) r.symbols.append(mapnik.LineSymbolizer(mapnik.Color('rgb(50%,50%,50%)'),0.1)) s = mapnik.Style() s.rules.append(r) m.append_style('World Style',s)
  • 25. Mapnik code example import mapnik m = mapnik.Map(600, 300, "+proj=latlong +datum=WGS84") m.background = mapnik.Color('steelblue') r = mapnik.Rule() r.symbols.append(mapnik.PolygonSymbolizer(mapnik.Color('#f2eff9'))) r.symbols.append(mapnik.LineSymbolizer(mapnik.Color('rgb(50%,50%,50%)'), 0.1)) s = mapnik.Style() s.rules.append(r) m.append_style('World Style',s)
  • 26. Mapnik code example import mapnik m = mapnik.Map(600, 300, "+proj=latlong +datum=WGS84") m.background = mapnik.Color('steelblue') r = mapnik.Rule() r.symbols.append(mapnik.PolygonSymbolizer(mapnik.Color('#f2eff9'))) r.symbols.append(mapnik.LineSymbolizer(mapnik.Color('rgb(50%,50%,50%)'), 0.1)) s = mapnik.Style() s.rules.append(r) m.append_style('World Style',s)
  • 27. Mapnik code example 2 lyr = mapnik.Layer('world', "+proj=latlong +datum=WGS84") lyr.datasource = mapnik.Shapefile(file='world_borders.shp') lyr.styles.append('World Style') m.layers.append(lyr) m.zoom_to_box(lyr.envelope()) mapnik.render_to_file(m,'world.png', 'png')
  • 28. Mapnik code example 2 lyr = mapnik.Layer('world', "+proj=latlong +datum=WGS84") lyr.datasource = mapnik.Shapefile(file='world_borders.shp') lyr.styles.append('World Style') m.layers.append(lyr) m.zoom_to_box(lyr.envelope()) mapnik.render_to_file(m,'world.png', 'png')
  • 29. Mapnik code example 2 lyr = mapnik.Layer('world', "+proj=latlong +datum=WGS84") lyr.datasource = mapnik.Shapefile(file='world_borders.shp') lyr.styles.append('World Style') m.layers.append(lyr) m.zoom_to_box(lyr.envelope()) mapnik.render_to_file(m,'world.png', 'png')
  • 32. Mapnik map services ● Tile Map Service ● Web Map Service
  • 33. Mapnik TMS http: //website.com/<zoom>/<x>/<y>.png ../tiles/12/2451/1360.png
  • 34. Mapnik using osm scripts ● svn export http://svn.openstreetmap.org/applications/rendering/... ● ./generate_xml.py --password 'value' --host 'value' --port 'value' --user 'value' --dbname 'value' ● MAPNIK_MAP_FILE='osm.xml' MAPNIK_TILE_DIR='tiles/' ./generate_tiles.py
  • 35. Mapnik XML <Map bgcolor="#b5d0d0"> <Style name="map_style"> <Rule> <MaxScaleDenominator>[scale]</MaxScaleDenominator> <MinScaleDenominator>[scale]</MinScaleDenominator> <Filter>[field]='value'</Filter> <PointSymbolizer/> <LineSymbolizer/> <PolygonSymbolizer/> … </Rule> </Style>
  • 36. Mapnik XML <Layer name="misc_boundaries"> <StyleName>map_style</StyleName> <Datasource> <Parameter name="table"> (select way,way_area,name,boundary from polygon where boundary='national_park') as boundary </Parameter> <Parameter name='dbname'>[dbname]</Parameter> <Parameter name='host'>[host]</Parameter> <Parameter name='user'>[user]</Parameter> … </Datasource> </Layer>
  • 39. Frontend maps choosing tool ● OpenLayers ● GeoExt ● Leaflet
  • 40. OpenLayers ● Most powerfull ● Most used ● Large community ● OSM supported ● OSM, Google, Yahoo maps in one string ● TMS, WMS, WFS ● GML, GeoJSON, GeoRSS