70
Apps4Finland: Maps4Finland Workshop Common geo informa6on programming examples 28.08.2012 Jari Reini

Maps4Finland 28.8.2012, Jari Reini

Embed Size (px)

DESCRIPTION

Jari Reini (National Land Survey of Finland): Common geo information programming examples. Video and more info: http://bit.ly/PbBTtV

Citation preview

Page 1: Maps4Finland 28.8.2012, Jari Reini

Apps4Finland:    Maps4Finland  Workshop    Common  geo  informa6on  programming  examples    28.08.2012  Jari  Reini  

Page 2: Maps4Finland 28.8.2012, Jari Reini

Agenda  §  Content  (NLS  Finland,  Sta6s6c  Finland,  Helsinki  Region  

Infoshare,  ….)  §  Content  handling  

§  Desktop  GIS:  Quantum  GIS  

§  Code  samples  §  Map  with  Openlayers  and  NLS  WMTS  §  Map  with  WMS  and  GeoJSON  §  Map  with  Google  Maps  §  OpenLayers  and  Openstreetmap  §  GeolocaBon  §  Coordinate  conversion  from  GPS  to  local  coordinate  system  §  Map  centered  to  current  locaBon  with  marker  (icon)  §  SpaBal  analysis  §  Oskari.org  

Page 3: Maps4Finland 28.8.2012, Jari Reini

NLS  Open  Data  

Topographic  Database  (vector)   Ortophotos  (0,5  m)  

Laser  scanning  data  (LAS)  Eleva6on  model  2m,  10m  …  (grid)  

Backround  maps  1:10.000  …  1:8  M  (raster)  Topographic  maps  1:25.000  …  (raster)    1:10.000  

hTp://www.m

aanm

iTausla

itos.fi/en

/ope

ndata    

Page 4: Maps4Finland 28.8.2012, Jari Reini

Terms  of  use  The  data  made  available  on  1  May  2012  are  granted  permanent    

and  free  right  of  use.  Free  right  of  use  means  that  available  topographic  data  products    

can  without  charge  be:  §  used  within  the  organisa6on    §  published  as  desired    §  distributed  freely  to  others    §  further  processed  to  new  products    §  sold                        ...or  used  in  any  other  way  

hTp://www.m

aanm

iTausla

itos.fi/en

/ope

ndata/term

s-­‐of-­‐use    

-­‐  men6on  the  name  of  the  Licensor,  the  name  of  the  dataset(s)  and        the  6me  when  the  Na6onal  Land  Survey  has  delivered  the  dataset(s)  -­‐  provide  a  copy  of  this  licence  or  a  link  to  it,  as  well  as  -­‐  require  third  par6es  to  provide  the  same  informa6on  when  gran6ng  rights  …  

Page 5: Maps4Finland 28.8.2012, Jari Reini

NLS  Open  Data  

§  hTps://6edostopalvelu.maanmiTauslaitos.fi/tp/karTa?lang=en  

§  Data  orders  to  be  delivered  manually  §  About  30  %  more  than  normally      

§  Delivery  by  web  communi6es    

§  hTp://paikka6eto.com/2012/05/0/        

§  hTp://kartat.kapsi.fi/    

Page 6: Maps4Finland 28.8.2012, Jari Reini

NLS  Open  Data  

Page 7: Maps4Finland 28.8.2012, Jari Reini
Page 8: Maps4Finland 28.8.2012, Jari Reini

NLS/Sta<s<cs  Finland  more  content  *  §  Aluehallintovirastot  [1]    (Regional  State  Administra6ve  Agencies)  §  Maakunnat  [1]    (Regions)  §  Kunnat  [1]      (Municipali6es)  §  ELY-­‐keskukset  [1][2]      (Centres  for  Economic  Development,  

Transport  and  the  Environment)  §  Kielisuhdeluokitus  [1][2]  (Language  distribu6on)  §  Sairaanhoitopiirit  [1][2]  (Hospital  District)  §  Seutukunnat  [1][2]    (Sub-­‐regional  units)  §  Suuralueet  [1][2]      (Major  regions)  §  Tilastollinen  kuntaryhmitys  [1][2]  (Sta6s6cal  grouping  of  municipali6es)  §  Työssäkäyn6alueet  [1][2]  (Working  district)  §  Vaalipiirit  [1][2]    (Electoral  district)  

§  [1]  NLS  Finland,  [2]  Sta6s6cs  Finland  §  *  To  be  delivered  via  Apps4Finland  

Page 9: Maps4Finland 28.8.2012, Jari Reini

Data  size  

§  Be  careful  with  the  data  size  ;-­‐)  

Page 10: Maps4Finland 28.8.2012, Jari Reini

More  content  §  Finland's  Na6onal  Board  of  An6qui6es  –  

hTp://paikka6eto.nba.fi/aineistot/MV_inspire_atom.xml  §  HRI  (Helsinki  Region  Infoshare)–  hTp://www.hri.fi  §  Finland’s  environmental  administra6on:  Oiva  -­‐  

hTp://wwwp2.ymparisto.fi/scripts/oiva.asp  §  Sta6s6cs  Finland  –  hTp://www.6lastokeskus.fi/  §  Suomi.fi  –  hTp://www.suomi.fi  §  PaITuli  (CSC  IT  Center  for  Science)  -­‐  

hTp://www.csc.fi/english/research/sciences/geo/gis/paituli/index_html  

§  Etc.  

 

Page 11: Maps4Finland 28.8.2012, Jari Reini

Content  handling  

Page 12: Maps4Finland 28.8.2012, Jari Reini

Quantum  GIS  

Page 13: Maps4Finland 28.8.2012, Jari Reini

Combine  spa<al  and  non-­‐spa<al  content  

§  Shape  file  and  csv  file  §  Join  tables  using  key  (e.g.  municipality  id)  §  In  this  case  using  Quantum  GIS  

Page 14: Maps4Finland 28.8.2012, Jari Reini

Combine  spa<al  and  non-­‐spa<al  content  

Page 15: Maps4Finland 28.8.2012, Jari Reini

Combine  spa<al  and  non-­‐spa<al  content  

Page 16: Maps4Finland 28.8.2012, Jari Reini

Combine  spa<al  and  non-­‐spa<al  content  

Page 17: Maps4Finland 28.8.2012, Jari Reini

Combine  spa<al  and  non-­‐spa<al  content  

Page 18: Maps4Finland 28.8.2012, Jari Reini

Conversion  from  Shape-­‐file  to  …  XXX  §  Shape  (shp)  is  a  de-­‐facto  file  format  for  GIS,  developed  by  ESRI  

§  Conversions  will  be  done  by  using  Open  Source  GDAL/OGR  library  §  hJp://www.gdal.org/ogr2ogr.html  §  It  converts  simple  features  data  between  file  formats  §  Supports  coordinate  transformaBons  (e.g.  from  GPS  (WGS84)  to  Finnish  naBonal  coordinate  system  (ETRS-­‐TM35FIN))  

Page 19: Maps4Finland 28.8.2012, Jari Reini

OGR2OGR  usage  

Page 20: Maps4Finland 28.8.2012, Jari Reini

Conversion  from  Shape-­‐file  to  GeoJSON  

§  ogr2ogr  -­‐f  geoJSON  CapitalRegion.json  CapitalRegion.shp  §  With  same  coordinate  system  as  the  original  

§  ogr2ogr  -­‐f  geoJSON  CapitalRegionWGS84.json  CapitalRegion.shp  -­‐t_srs  EPSG:4326  §  Converted  to  WGS84  coordinate  system  (lon/lat)  

Page 21: Maps4Finland 28.8.2012, Jari Reini

Web  Services  and  code  samples  

Page 22: Maps4Finland 28.8.2012, Jari Reini

Interface  standards  

§  WMS  Web  Map  Service  o  Serves  georeferenced  images  

§  WMTS  Web  Map  Tiling  Service  o  provides  map  Bles  (small  images  

that  are  part  of  a  map)  

hTp://www.opengeospa6al.org/standards/wmts  

hTp://www.opengeospa6al.org/standards/wms  

Page 23: Maps4Finland 28.8.2012, Jari Reini

Interface  standards  §  WFS  Web  Feature  Service  

o  an  interface  allowing  requests  for  geographical  features  across  the  web  

o  GML  

hTp://www.opengeospa6al.org/standards/wfs  hTp://www.opengeospa6al.org/standards/filter  

Page 24: Maps4Finland 28.8.2012, Jari Reini

Standards  §  hTp://www.opengeospa6al.org/standards/  

Page 25: Maps4Finland 28.8.2012, Jari Reini

Spa<al  architecture  (by  INSPIRE)  

Service  metadata  

Dataset  metadata  

Schemas  Code  lists  Styles  

Applica6ons  and  portals  

Rights  management  layer  

Invoke  service  

Transform.  service  

WPS/WCTS  

       Service  bus  

Registry    service  

Discovery  service  CSW  

View  service  

WMS,  WMTS  

Download  service  WFS  

Service  layer  

Data  sources  

Spa6al    datasets  

Javascript  Etc.  

Page 26: Maps4Finland 28.8.2012, Jari Reini

Publish  content  via  WMS  (Geoserver)  

§  geoserver.war    (Tomcat,  JeTy  jne)  

Page 27: Maps4Finland 28.8.2012, Jari Reini

29.8.2012 Jari Reini

Publish  content  via  WMS  (Geoserver)  

§  Add Store (shape, PostGIS, GeoTIFF etc.) §  Vector (shape file, database (PostGIS)) §  Raster (GeoTIFF)

§  Create a base map (by adding a layer from store)

§  Add a style (using SLD - Styled Layer Descriptor)

§  Test using OpenLayers and check GetCapabilities using WMS-service

Page 28: Maps4Finland 28.8.2012, Jari Reini

WMS  example  §  hTps://ws.nls.fi/rasteriaineistot/test/index.html  

Page 29: Maps4Finland 28.8.2012, Jari Reini

Demo:  Add  content  to  Geoserver  

Page 30: Maps4Finland 28.8.2012, Jari Reini

Web  map:  OpenLayers  

§  hTp://www.openlayers.org/  

Page 31: Maps4Finland 28.8.2012, Jari Reini

OpenLayers  and  WMTS  

Page 32: Maps4Finland 28.8.2012, Jari Reini

Source  code  and  demo:  OL  and  WMTS  

Page 33: Maps4Finland 28.8.2012, Jari Reini

GeoJSON  

§  GeoJSON  is  a  format  for  encoding  a  variety  of  geographic  data  structures  

§  Point,  LineString,  Polygon,  Mul6Point,  Mul6LineString,  Mul6Polygon,  and  GeometryCollec6on  

§  hTp://www.geojson.org/  

Page 34: Maps4Finland 28.8.2012, Jari Reini

GeoJSON  example  §  {"type":  "FeatureCollec6on","features":  [{  "type":  "Feature",  "proper6es":  {  "KUNTAKOODI":  "049",  "NIMI_FI":  "Espoo",  

"NIMI_SE":  "Esbo"  },  "geometry":  {  "type":  "Mul6Polygon",  "coordinates":  [  [  [  [  24.571160,  60.174957  ],  [  24.569053,  60.179302  ],  [  24.536214,  60.196464  ],  [  24.524747,  60.205349  ],  [  24.503201,  60.212863  ],  [  24.525406,  60.231022  ],  [  24.525024,  60.246582  ],  [  24.504336,  60.255430  ],  [  24.504449,  60.274086  ],  [  24.515569,  60.281292  ],  [  24.512038,  60.291734  ],  [  24.500169,  60.326289  ],  [  24.562672,  60.314085  ],  [  24.595654,  60.324185  ],  [  24.614089,  60.344366  ],  [  24.627694,  60.359241  ],  [  24.664705,  60.362770  ],  [  24.683964,  60.357999  ],  [  24.702266,  60.353460  ],  [  24.749283,  60.341783  ],  [  24.746237,  60.322274  ],  [  24.760928,  60.325376  ],  [  24.771802,  60.299231  ],  [  24.764941,  60.271237  ],  [  24.784754,  60.241505  ],  [  24.831403,  60.254055  ],  [  24.841913,  60.221200  ],  [  24.848062,  60.218600  ],  [  24.847341,  60.215472  ],  [  24.845160,  60.217551  ],  [  24.840428,  60.217474  ],  [  24.829067,  60.212933  ],  [  24.823169,  60.208482  ],  [  24.817308,  60.203486  ],  [  24.817365,  60.197136  ],  [  24.821679,  60.192489  ],  [  24.824589,  60.192537  ],  [  24.826356,  60.187848  ],  [  24.825768,  60.180217  ],  [  24.823415,  60.177275  ],  [  24.811442,  60.176715  ],  [  24.805746,  60.174806  ],  [  24.797870,  60.172861  ],  [  24.789414,  60.168728  ],  [  24.777763,  60.163452  ],  [  24.773439,  60.162835  ],  [  24.765414,  60.157800  ],  [  24.759674,  60.156615  ],  [  24.748360,  60.149913  ],  [  24.735985,  60.150065  ],  [  24.726578,  60.154622  ],  [  24.717032,  60.155909  ],  [  24.712736,  60.154928  ],  [  24.706986,  60.153921  ],  [  24.694366,  60.147169  ],  [  24.687286,  60.139243  ],  [  24.683649,  60.134098  ],  [  24.675721,  60.127970  ],  [  24.670678,  60.127337  ],  [  24.661722,  60.130627  ],  [  24.656979,  60.135988  ],  [  24.650108,  60.140584  ],  [  24.641925,  60.143160  ],  [  24.628939,  60.151821  ],  [  24.622682,  60.157878  ],  [  24.615088,  60.162279  ],  [  24.605000,  60.165908  ],  [  24.596041,  60.169012  ],  [  24.583689,  60.173687  ],  [  24.572253,  60.175317  ],  [  24.571160,  60.174957  ]  ],  [  [  24.701820,  60.206242  ],  [  24.722176,  60.202563  ],  [  24.739162,  60.207110  ],  [  24.750914,  60.218211  ],  [  24.744871,  60.220382  ],  [  24.734320,  60.224171  ],  [  24.715896,  60.224721  ],  [  24.706264,  60.225008  ],  [  24.677472,  60.215397  ],  [  24.675287,  60.211031  ],  [  24.701820,  60.206242  ]  ]  ],  [  [  [  24.754352,  60.104463  ],  [  24.750329,  60.107136  ],  [  24.749955,  60.112613  ],  [  24.761466,  60.112808  ],  [  24.767115,  60.110436  ],  [  24.766297,  60.106310  ],  [  24.754352,  60.104463  ]  ]  ],  [  [  [  24.775577,  60.131414  ],  [  24.767546,  60.136488  ],  [  24.774892,  60.141546  ],  [  24.783196,  60.140589  ],  [  24.785358,  60.132949  ],  [  24.775577,  60.131414  ]  ]  ],  [  [  [  24.843346,  60.185501  ],  [  24.843360,  60.185235  ],  [  24.843175,  60.185369  ],  [  24.843346,  60.185501  ]  ]  ],  [  [  [  24.685266,  60.103820  ],  [  24.676807,  60.099286  ],  [  24.665849,  60.099093  ],  [  24.665422,  60.105117  ],  [  24.671650,  60.110161  ],  [  24.680420,  60.110315  ],  [  24.685266,  60.103820  ]  ]  ],  [  [  [  24.655124,  60.080777  ],  [  24.647554,  60.088991  ],  [  24.648432,  60.089463  ],  [  24.660521,  60.089129  ],  [  24.662005,  60.083672  ],  [  24.655124,  60.080777  ]  ]  ],  [  [  [  24.702720,  60.113172  ],  [  24.696384,  60.117448  ],  [  24.704073,  60.125258  ],  [  24.704164,  60.131839  ],  [  24.709496,  60.134125  ],  [  24.719955,  60.133757  ],  [  24.724589,  60.130273  ],  [  24.723531,  60.121756  ],  [  24.710923,  60.113588  ],  [  24.702720,  60.113172  ]  ]  ],  [  [  [  24.844243,  60.168753  ],  [  24.844412,  60.165584  ],  [  24.841603,  60.154288  ],  [  24.839184,  60.154052  ],  [  24.839634,  60.163929  ],  [  24.844243,  60.168753  ]  ]  ]  ]  }  },  

Page 35: Maps4Finland 28.8.2012, Jari Reini

OpenLayers  with  WMS  and  GeoJSON  

Page 36: Maps4Finland 28.8.2012, Jari Reini

OpenLayers  with  WMS  and  GeoJSON  

Page 37: Maps4Finland 28.8.2012, Jari Reini

Source  code  and  demo:  OL  and  WMS  and  GeoJSON  

Page 38: Maps4Finland 28.8.2012, Jari Reini

Google  Maps  §  Easy  way  to  build  interac6ve  data  visualiza6ons  on  a  map  and  loca6on-­‐based  apps  §  hJps://developers.google.com/maps/documentaBon/javascript/reference  

Page 39: Maps4Finland 28.8.2012, Jari Reini

Google  Maps  

Page 40: Maps4Finland 28.8.2012, Jari Reini

Source  code  and  demo:  Google  Maps  

Page 41: Maps4Finland 28.8.2012, Jari Reini

KML  from  MySQL  database  #  one  6me  only  #  create  table  #===============    @mysql_select_db($database)  or  die(  "Unable  to  

select  database:"  .  mysql_error());    $query="CREATE  TABLE  kml_poi_sample  (lat  

decimal(10,5)  NOT  NULL,  lng  decimal(10,5)  NOT  NULL,  descrip6on    varchar(100)  NOT  NULL,  id  int(11)  NOT  NULL  auto_increment,  PRIMARY  KEY    (`id`))";  

mysql_query($query);  mysql_close();    echo  "Database  created";    #new  values  #=================    $query  =  "INSERT  INTO  kml_poi_sample  VALUES  

('$lat','$lng','$descrip6on',$maxid)";  $result=mysql_query($query);  if  (!$result)  {          die('Error:  '  .  mysql_error());  }        

#  get  KML  #  ================  <?php  require('dbinfo.php');    //  Opens  a  connec6on  to  a  MySQL  server.  $connec6on  =  mysql_connect  ($server,  $username,  

$password);  if  (!$connec6on)    {      die('Not  connected  :  '  .  mysql_error());  }  //  Sets  the  ac6ve  MySQL  database.  $db_selected  =  mysql_select_db($database,  

$connec6on);  if  (!$db_selected)    {      die  ('Can\'t  use  db  :  '  .  mysql_error());  }    //  Selects  all  the  rows  $sql  =  'select  id,name,  lat,  lng,  descrip6on  from  

kml_poi_sample';      $result  =  mysql_query($sql);  

Page 42: Maps4Finland 28.8.2012, Jari Reini

KML  from  MySQL  database  //  Create  output  $kml  =  array('<?xml  version="1.0"  encoding="UTF-­‐8"?>');  $kml[]  =  '<kml  xmlns="hTp://earth.google.com/kml/2.1">';  $kml[]  =  '<Document>';  $kml[]  =  '<Style  id="downArrowIcon">';  $kml[]  =  '<IconStyle>';  $kml[]  =  '<Icon>';  $kml[]  =  '<href>hTp://maps.google.com/mapfiles/kml/pushpin/grn-­‐pushpin.png</href>';  $kml[]  =  '</Icon>';  $kml[]  =  '</IconStyle>';  $kml[]  =  '</Style>';    while  ($row  =  @mysql_fetch_assoc($result))  {      $kml[]  =  '  <Placemark  id="placemark'  .  $row['id']  .  '">';      $kml[]  =  '  <name>'  .  htmlen66es($row['name'])  .  '</name>';      $kml[]  =  '  <descrip6on>'  .  htmlen66es($row['descrip6on'])  .  '</descrip6on>';      $kml[]  =  '  <styleUrl>#downArrowIcon</styleUrl>';      $kml[]  =  '  <Point>';      $kml[]  =  '  <coordinates>'  .  $row['lng']  .  ','    .  $row['lat']  .  '</coordinates>';      $kml[]  =  '  </Point>';      $kml[]  =  '  </Placemark>';  }  

//  End  XML  file  $kml[]  =  '  </Document>';  $kml[]  =  '</kml>';  $kmlOutput  =  join("\n",  $kml);  header('Content-­‐type:  applica6on/vnd.google-­‐

earth.kml+xml');  #header('Content-­‐type:  text/xml');  echo  $kmlOutput;  ?>  

Page 43: Maps4Finland 28.8.2012, Jari Reini

KML  in  Google  Maps  §  hTps://maps.google.com/maps?q=hTp://service.fi/map/kml/getkmlsample.php  

Page 44: Maps4Finland 28.8.2012, Jari Reini

KML  in  Google  Earth  

Page 45: Maps4Finland 28.8.2012, Jari Reini

Address  search  using  WFS  

§  NLS  WFS  service  §  Send    hTp  post  request  and  get  back  XML/GML  

§  (demonstrate  using  Firefox  Poster)  §  hTp://xml.nls.fi/Nimisto/Asiakasdokumentaa6o/WFS/Kuvaus/getCapabili6es_vastaus.xml  

§  hTp://xml.nls.fi/Maasto/Maasto6etokanta/Asiakasdokumentaa6o/WFS/Kuvaus/GetCapabili6es_vastaus.xml  

Page 46: Maps4Finland 28.8.2012, Jari Reini

Address  search:  Opas<nsilta  12  Helsinki  §  <?xml  version="1.0"  encoding="UTF-­‐8"?>  

<wfs:GetFeature  version="1.1.0"  xmlns:oso="hTp://xml.nls.fi/OsoiTeet/Osoitepiste/2011/02"  xmlns:wfs="hTp://www.opengis.net/wfs"  xmlns:gml="hTp://www.opengis.net/gml"  xmlns:ogc="hTp://www.opengis.net/ogc"  xmlns:xsi="hTp://www.w3.org/2001/XMLSchema-­‐instance"  xsi:schemaLoca6on="hTp://www.opengis.net/wfs  hTp://schemas.opengis.net/wfs/1.1.0/wfs.xsd">    <wfs:Query  typeName="oso:Osoitenimi">      <ogc:Filter>                                                <ogc:And>                                                                <ogc:PropertyIsEqualTo>                                                                                <ogc:PropertyName>oso:kuntanimiFin</ogc:PropertyName>                                                                              <ogc:Literal>Helsinki</ogc:Literal>                                                                </ogc:PropertyIsEqualTo>                                                                <ogc:PropertyIsEqualTo>                                                                              <ogc:PropertyName>oso:katunimi</ogc:PropertyName>                                                                              <ogc:Literal>Opas4nsilta</ogc:Literal>                                                                </ogc:PropertyIsEqualTo>                                                                <ogc:PropertyIsEqualTo>                                                                              <ogc:PropertyName>oso:katunumero</ogc:PropertyName>                                                                              <ogc:Literal>12</ogc:Literal>                                                                </ogc:PropertyIsEqualTo>                                                </ogc:And>                                </ogc:Filter>  

§   </wfs:Query>  </wfs:GetFeature>  

Page 47: Maps4Finland 28.8.2012, Jari Reini

Response:  Opas<nsilta  12  Helsinki  

Page 48: Maps4Finland 28.8.2012, Jari Reini

Demo:  Address  search  using  HTTP  POST  and  WFS  

Page 49: Maps4Finland 28.8.2012, Jari Reini

Other  WFS  examples  §  GetCapabili4es  

hTp://localhost:8080/geoserver/ows?service=wfs&version=1.1.0&request=GetCapabili6es    

§  DescribeFeatureType    §  hTp://localhost:8080/geoserver/wfs?

service=WFS&version=1.1.0&request=DescribeFeatureType&Typename=nls:municipali6es    

§  GetFeature    §  hTp://localhost:8080/geoserver/wfs?

service=WFS&version=1.1.0&request=GetFeature&Typename=nls:municipali6es&maxfeatures=1    

§  GetFeature    in  JSON  §  hTp://localhost:8080/geoserver/ows?

service=WFS&version=1.0.0&request=GetFeature&typeName=nls:municipali6es&maxFeatures=1&outputFormat=json  

§  GetFeature  ETRS89  hTp://localhost:8080/geoserver/wfs?service=WFS&version=1.1.0&request=GetFeature&Typename=nls:municipali6es&maxfeatures=2&srsName=urn:x-­‐ogc:def:crs:EPSG:4258    

Page 50: Maps4Finland 28.8.2012, Jari Reini

Using  Geoloca<on  

§  Geoloca6on  API  Specifica6on    §  hJp://dev.w3.org/geo/api/spec-­‐source.html  

§  API  provides  scripted  access  to  geographical  loca6on  informa6on  associated  with  the  hos6ng  device  

Page 51: Maps4Finland 28.8.2012, Jari Reini

Coordinate  conversion  

§  From  GPS  to  ETRS-­‐TM35FIN  §  From  GPS  to  ”Web  Mercator”  (used  by  Google  and  OpenStreetMap)  

§  Proj4js  is  a  JavaScript  library  to  transform  point  coordinates  from  one  coordinate  system  to  another  §  hJp://trac.osgeo.org/proj4js/  

Page 52: Maps4Finland 28.8.2012, Jari Reini

Coordinate  conversion  

Page 53: Maps4Finland 28.8.2012, Jari Reini

Source  code  and  demo:  geoloca<on  and  coordinate  conversions  

Page 54: Maps4Finland 28.8.2012, Jari Reini

OpenStreetMap  

Page 55: Maps4Finland 28.8.2012, Jari Reini

OpenStreetMap  and  OpenLayers  w/  loca<on  

Page 56: Maps4Finland 28.8.2012, Jari Reini

Source  code  and  demo:  Openstreetmap  and  the  current  loca<on  

Page 57: Maps4Finland 28.8.2012, Jari Reini

Spa<al  analysis  §  Spa6al  analysis  may  include  tasks  such  as  

§  Who  are  my  neighbors?  §  In  which  postal  code  or  municipality  I’m  currently?  

§  Spa6al  SQL  standardized  in  SQLMM  :  ISO/IEC  13249l  §  RelaBonship  

§  True  or  false  §  Processing  

§  Gives  you  a  new  geometry  §  Measurement  

§  Calculates  something  §  You  may  use  

§  Database  (SQL)  §  Map  server  (e.g.  Geoserver)  §  Javasicript  etc.  libraries  

Page 58: Maps4Finland 28.8.2012, Jari Reini

Geometry  types  and  topological  rela<onships  

Page 59: Maps4Finland 28.8.2012, Jari Reini

Spa<al  analysis  -­‐  func<ons  §  ST_Area  §  ST_AsBinary  §  ST_AsText  §  ST_Boundary  §  ST_Buffer  §  ST_Centroid  §  ST_Contains  §  ST_ConvexHull  §  ST_CoordDim  §  ST_Crosses  §  ST_Difference  §  ST_Dimension  §  ST_Disjoint  §  ST_Distance  §  ST_EndPoint  §  ST_Envelope  §  ST_Equals  §  ST_ExteriorRing  §  ST_GeometryN  §  ST_GeometryType  §  ST_GeomFromText  §  ST_GeomFromWKB  §  ST_InteriorRingN  

§  ST_Intersec6on  §  ST_Intersects  §  ST_IsClosed  §  ST_IsEmpty  §  ST_IsRing  §  ST_IsSimple  §  ST_IsValid  §  ST_Length  §  ST_LineFromText  §  ST_LineFromWKB  §  ST_MLineFromText  §  ST_MLineFromWKB  §  ST_MPointFromText  §  ST_MPointFromWKB  §  ST_MPolyFromText  §  ST_MPolyFromWKB  §  ST_NumGeometries  §  ST_NumInteriorRing  §  ST_NumPoints  §  ST_OrderingEquals  §  ST_Overlaps  

§  ST_Perimeter  §  ST_Point  §  ST_PointFromText  §  ST_PointFromWKB  §  ST_PointN  §  ST_PointOnSurface  §  ST_PolyFromText  §  ST_PolyFromWKB  §  ST_Polygon  §  ST_Relate  §  ST_SRID  §  ST_StartPoint  §  ST_SymDifferenc  §  e  §  ST_Touches  §  ST_Transform  §  ST_Union  §  ST_Within  §  ST_WKBToSQL  §  ST_WKTToSQL  §  ST_X  §  ST_Y  

Page 60: Maps4Finland 28.8.2012, Jari Reini

Spa<al  analysis  -­‐examples  §  In  which  municipality  I  am?  

§  Select  nimi_fi  from  municipaliBes  where  Intersects(GeomFromText('POINT  (387324.2534026944  6678252.651510533)'),  GEOMETRY);  

§  Neighboring  municipali6es  §  Select  nimi_fi  from  municipaliBes  where  Touches((select  GEOMETRY  from  municipaliBes  where  nimi_fi=‘Helsinki’),  GEOMETRY);  

§  Municipali6es  in  50  km  circle  from  here  §  Select  nimi_fi  from  municipaliBes  where  Intersects(Buffer(GeomFromText('POINT  (387324.2534026944  6678252.651510533)'),  50000),  GEOMETRY);  

Page 61: Maps4Finland 28.8.2012, Jari Reini

Spa<al  analysis  in  prac<ce  using  Spa<alite  database  

Page 62: Maps4Finland 28.8.2012, Jari Reini

Tools  from  OpenGeo  §  hTp://live.osgeo.org  

Page 63: Maps4Finland 28.8.2012, Jari Reini

OSGeo-­‐Live  6.0  Contents  §  Browser  Clients  

§  OpenLayers  -­‐  Browser  GIS  Client  §  Geomajas  -­‐  Browser  GIS  Client  §  Mapbender  -­‐  Geoportal  Framework  §  MapFish  -­‐  Web  Mapping  Framework  §  GeoMoose  -­‐  Web  GIS  Portal  

§  Databases  §  PostGIS  -­‐  SpaBal  Database  §  SpaBaLite  -­‐  Lightweight  Database  §  Rasdaman  -­‐  MulB-­‐Dimensional  Raster  Database  §  pgRouBng  -­‐  RouBng  for  PostGIS  

Page 64: Maps4Finland 28.8.2012, Jari Reini

OSGeo-­‐Live  6.0  Contents  §  Desktop  GIS  

§  Quantum  GIS  (QGIS)  §  GRASS  GIS  §  gvSIG  Desktop  §  User-­‐friendly  Desktop  Internet  GIS  (uDig)  §  Kosmo  Desktop  §  OpenJUMP  GIS  

§  Spa6al  Tools  §  GeoKeJle    -­‐  ETL  (Extract,  Transform  and  Load)  Tool  §  GDAL/OGR    -­‐  GeospaBal  Data  TranslaBon  Tools  §  GMT  -­‐  Cartographic  Rendering  §  Mapnik  -­‐  Cartographic  Rendering  §  MapTiler  -­‐  Create  Map  Tiles  §  OTB  -­‐  Image  Processing  §  R  for  SpaBal  Data  -­‐  StaBsBcal  Programming  

§  And  much  more…  

Page 65: Maps4Finland 28.8.2012, Jari Reini

www.oskari.org    

Open  Source  Map  Applica<on  Framework  

Page 66: Maps4Finland 28.8.2012, Jari Reini

Spa<al  Data  Service  Pla_orm  -­‐  OSKARI  

§  OSKARI  =  Open  Source  KarTaikkuna  (stands  for  Open  Source  map  window)  §  …but  OSKARI  is  more  than  just  a  map  window  in  a  Geoportal…  

§  OSKARI  is  an  Open  Source  based    Spa4al  Data  Service  PlaIorm  –  key  principals:  §  Use  exisBng  OS  components:  e.g.  OpenLayers,  jQuery  §  All  developed  code  is  released  under  MIT/  EUPL  licenses  §  Flexible  architecture  allows  for  adding  funcBonality  both  on  the  server  and  client  side  

Page 67: Maps4Finland 28.8.2012, Jari Reini

OSKARI  evolu<on  

Page 68: Maps4Finland 28.8.2012, Jari Reini

Samples  §  All  the  code  samples  will  be  available  at  Github  Apps4Finland  

§  hTps://github.com/Apps4Finland  §  And  §  hTps://github.com/reinij  §  …  use  at  your  own  risk  §  …  add  comments,  do  tes6ng  …  

Page 69: Maps4Finland 28.8.2012, Jari Reini

Interested  in  knowing  more…?  §  hTp://www.uli.se/ogc-­‐nordic-­‐interoperability-­‐day/agenda  

§  September  3rd  in  Stockholm  

Page 70: Maps4Finland 28.8.2012, Jari Reini

Now:  any  ques<ons  and  comments?  Later  on:  [email protected]