Apps4Finland:	  	  Maps4Finland	  Workshop	  	  Common	  geo	  informa6on	  programming	  examples	  	  28.08.2012	  Jari	...
Agenda	  §  Content	  (NLS	  Finland,	  Sta6s6c	  Finland,	  Helsinki	  Region	      Infoshare,	  ….)	  §  Content	  han...
NLS	  Open	  Data	  Topographic	  maps	  1:25.000	  …	  (raster)	  	     Backround	  maps	  1:10.000	  …	  1:8	  M	  (rast...
Terms	  of	  use	  The	  data	  made	  available	  on	  1	  May	  2012	  are	  granted	  permanent	  	                    ...
NLS	  Open	  Data	  §  hTps://6edostopalvelu.maanmiTauslaitos.fi/tp/karTa?    lang=en	  §  Data	  orders	  to	  be	  deli...
NLS	  Open	  Data	  
NLS/Sta<s<cs	  Finland	  more	  content	  *	  §    Aluehallintovirastot	  [1]	         	  (Regional	  State	  Administra6...
Data	  size	  §  Be	  careful	  with	  the	  data	  size	  ;-­‐)	  
More	  content	  §  Finlands	  Na6onal	  Board	  of	  An6qui6es	  –	      hTp://paikka6eto.nba.fi/aineistot/MV_inspire_ato...
Content	  handling	  
Quantum	  GIS	  
Combine	  spa<al	  and	  non-­‐spa<al	  content	  §  Shape	  file	  and	  csv	  file	  §  Join	  tables	  using	  key	  (e...
Combine	  spa<al	  and	  non-­‐spa<al	  content	  
Combine	  spa<al	  and	  non-­‐spa<al	  content	  
Combine	  spa<al	  and	  non-­‐spa<al	  content	  
Combine	  spa<al	  and	  non-­‐spa<al	  content	  
Conversion	  from	  Shape-­‐file	  to	  …	  XXX	  §  Shape	  (shp)	  is	  a	  de-­‐facto	  file	  format	  for	  GIS,	     ...
OGR2OGR	  usage	  
Conversion	  from	  Shape-­‐file	  to	  GeoJSON	  §  ogr2ogr	  -­‐f	  geoJSON	  CapitalRegion.json	      CapitalRegion.shp...
Web	  Services	  and	  code	  samples	  
Interface	  standards	   §  WMS	  Web	  Map	  Service	        o  Serves	  georeferenced	  images	  hTp://www.opengeospa6a...
Interface	  standards	  §  WFS	  Web	  Feature	  Service	       o  an	  interface	  allowing	  requests	  for	          g...
Standards	  §  hTp://www.opengeospa6al.org/standards/	  
Spa<al	  architecture	  (by	  INSPIRE)	                                                          Javascript	              ...
Publish	  content	  via	  WMS	  (Geoserver)	  §  geoserver.war	  	  (Tomcat,	  JeTy	  jne)	  
Publish	  content	  via	  WMS	  (Geoserver)	  §  Add Store (shape, PostGIS, GeoTIFF etc.)  §  Vector (shape file, databa...
WMS	  example	  §  hTps://ws.nls.fi/rasteriaineistot/test/index.html	  
Demo:	  Add	  content	  to	  Geoserver	  
Web	  map:	  OpenLayers	  §  hTp://www.openlayers.org/	  
OpenLayers	  and	  WMTS	  
Source	  code	  and	  demo:	  OL	  and	  WMTS	  
GeoJSON	  §  GeoJSON	  is	  a	  format	  for	  encoding	  a	  variety	  of	      geographic	  data	  structures	  §  Poi...
GeoJSON	  example	  §    {"type":	  "FeatureCollec6on","features":	  [{	  "type":	  "Feature",	  "proper6es":	  {	  "KUNT...
OpenLayers	  with	  WMS	  and	  GeoJSON	  
OpenLayers	  with	  WMS	  and	  GeoJSON	  
Source	  code	  and	  demo:	  OL	  and	  WMS	  and	  GeoJSON	  
Google	  Maps	  §  Easy	  way	  to	  build	  interac6ve	  data	  visualiza6ons	  on	  a	      map	  and	  loca6on-­‐based...
Google	  Maps	  
Source	  code	  and	  demo:	  Google	  Maps	  
KML	  from	  MySQL	  database	  #	  one	  6me	  only	                                                                #	  g...
KML	  from	  MySQL	  database	  //	  Create	  output	  $kml	  =	  array(<?xml	  version="1.0"	  encoding="UTF-­‐8"?>);	   ...
KML	  in	  Google	  Maps	  §  hTps://maps.google.com/maps?q=hTp://service.fi/    map/kml/getkmlsample.php	  
KML	  in	  Google	  Earth	  
Address	  search	  using	  WFS	  §  NLS	  WFS	  service	  §  Send	  	  hTp	  post	  request	  and	  get	  back	  XML/GML...
Address	  search:	  Opas<nsilta	  12	  Helsinki	  §    <?xml	  version="1.0"	  encoding="UTF-­‐8"?>	        <wfs:GetFeatu...
Response:	  Opas<nsilta	  12	  Helsinki	  
Demo:	  Address	  search	  using	  HTTP	  POST	  and	  WFS	  
Other	  WFS	  examples	  §  GetCapabili4es	      hTp://localhost:8080/geoserver/ows?    service=wfs&version=1.1.0&request...
Using	  Geoloca<on	  §  Geoloca6on	  API	  Specifica6on	  	      §  hJp://dev.w3.org/geo/api/spec-­‐source.html	  §  API...
Coordinate	  conversion	  §  From	  GPS	  to	  ETRS-­‐TM35FIN	  §  From	  GPS	  to	  ”Web	  Mercator”	  (used	  by	  Goo...
Coordinate	  conversion	  
Source	  code	  and	  demo:	  geoloca<on	  and	  coordinate	  conversions	  
OpenStreetMap	  
OpenStreetMap	  and	  OpenLayers	  w/	  loca<on	  
Source	  code	  and	  demo:	  Openstreetmap	  and	  the	  current	  loca<on	  
Spa<al	  analysis	  §  Spa6al	  analysis	  may	  include	  tasks	  such	  as	       §  Who	  are	  my	  neighbors?	     ...
Geometry	  types	  and	  topological	  rela<onships	  
Spa<al	  analysis	  -­‐	  func<ons	                     §                                                             § ...
Spa<al	  analysis	  -­‐examples	  §  In	  which	  municipality	  I	  am?	       §  Select	  nimi_fi	  from	  municipaliBe...
Spa<al	  analysis	  in	  prac<ce	  using	  Spa<alite	  database	  
Tools	  from	  OpenGeo	  §  hTp://live.osgeo.org	  
OSGeo-­‐Live	  6.0	  Contents	  §  Browser	  Clients	      §    OpenLayers	  -­‐	  Browser	  GIS	  Client	      §    Ge...
OSGeo-­‐Live	  6.0	  Contents	  §  Desktop	  GIS	       §    Quantum	  GIS	  (QGIS)	       §    GRASS	  GIS	       §  ...
Open	  Source	  Map	  Applica<on	  Framework	                                                    www.oskari.org	  	  
Spa<al	  Data	  Service	  Pla_orm	  -­‐	  OSKARI	  §  OSKARI	  =	  Open	  Source	  KarTaikkuna	  (stands	  for	  Open	   ...
OSKARI	  evolu<on	  
Samples	  §  All	  the	  code	  samples	  will	  be	  available	  at	  Github	      Apps4Finland	  §    hTps://github.co...
Interested	  in	  knowing	  more…?	  §  hTp://www.uli.se/ogc-­‐nordic-­‐interoperability-­‐day/agenda	  §  September	  3...
Now:	  any	  ques<ons	  and	  comments?	  Later	  on:	  firstname.lastname@nls.fi	  
Maps4Finland 28.8.2012, Jari Reini
Upcoming SlideShare
Loading in …5
×

Maps4Finland 28.8.2012, Jari Reini

1,495 views

Published on

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

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,495
On SlideShare
0
From Embeds
0
Number of Embeds
912
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Maps4Finland 28.8.2012, Jari Reini

  1. 1. Apps4Finland:    Maps4Finland  Workshop    Common  geo  informa6on  programming  examples    28.08.2012  Jari  Reini  
  2. 2. 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  
  3. 3. NLS  Open  Data  Topographic  maps  1:25.000  …  (raster)     Backround  maps  1:10.000  …  1:8  M  (raster)  1:10.000   hTp://www.maanmiTauslaitos.fi/en/opendata     Topographic  Database  (vector)   Ortophotos  (0,5  m)   Eleva6on  model  2m,  10m  …  (grid)   Laser  scanning  data  (LAS)  
  4. 4. Terms  of  use  The  data  made  available  on  1  May  2012  are  granted  permanent     hTp://www.maanmiTauslaitos.fi/en/opendata/terms-­‐of-­‐use     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   -­‐  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  …  
  5. 5. 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/    
  6. 6. NLS  Open  Data  
  7. 7. 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  
  8. 8. Data  size  §  Be  careful  with  the  data  size  ;-­‐)  
  9. 9. More  content  §  Finlands  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.  
  10. 10. Content  handling  
  11. 11. Quantum  GIS  
  12. 12. 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  
  13. 13. Combine  spa<al  and  non-­‐spa<al  content  
  14. 14. Combine  spa<al  and  non-­‐spa<al  content  
  15. 15. Combine  spa<al  and  non-­‐spa<al  content  
  16. 16. Combine  spa<al  and  non-­‐spa<al  content  
  17. 17. 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))  
  18. 18. OGR2OGR  usage  
  19. 19. 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)  
  20. 20. Web  Services  and  code  samples  
  21. 21. Interface  standards   §  WMS  Web  Map  Service   o  Serves  georeferenced  images  hTp://www.opengeospa6al.org/standards/wms   §  WMTS  Web  Map  Tiling  Service   o  provides  map  Bles  (small  images   that  are  part  of  a  map)  hTp://www.opengeospa6al.org/standards/wmts  
  22. 22. 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  
  23. 23. Standards  §  hTp://www.opengeospa6al.org/standards/  
  24. 24. Spa<al  architecture  (by  INSPIRE)   Javascript   Etc.   Applica6ons  and  portals          Service  bus   Rights  management  layer  Service  layer   Registry     Discovery   View   Download   Transform.   Invoke   service   service   service   service   service   service   CSW   WMS,  WMTS   WFS   WPS/WCTS  Data  sources   Schemas   Service   Dataset   Code  lists   metadata   metadata   Styles   Spa6al     datasets  
  25. 25. Publish  content  via  WMS  (Geoserver)  §  geoserver.war    (Tomcat,  JeTy  jne)  
  26. 26. 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 Jari Reini 29.8.2012
  27. 27. WMS  example  §  hTps://ws.nls.fi/rasteriaineistot/test/index.html  
  28. 28. Demo:  Add  content  to  Geoserver  
  29. 29. Web  map:  OpenLayers  §  hTp://www.openlayers.org/  
  30. 30. OpenLayers  and  WMTS  
  31. 31. Source  code  and  demo:  OL  and  WMTS  
  32. 32. 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/  
  33. 33. 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  ]  ]  ]  ]  }  },  
  34. 34. OpenLayers  with  WMS  and  GeoJSON  
  35. 35. OpenLayers  with  WMS  and  GeoJSON  
  36. 36. Source  code  and  demo:  OL  and  WMS  and  GeoJSON  
  37. 37. Google  Maps  §  Easy  way  to  build  interac6ve  data  visualiza6ons  on  a   map  and  loca6on-­‐based  apps   §  hJps://developers.google.com/maps/documentaBon/ javascript/reference  
  38. 38. Google  Maps  
  39. 39. Source  code  and  demo:  Google  Maps  
  40. 40. KML  from  MySQL  database  #  one  6me  only   #  get  KML  #  create  table   #  ================  #===============   <?php     require(dbinfo.php);  @mysql_select_db($database)  or  die(  "Unable  to   select  database:"  .  mysql_error());    //  Opens  a  connec6on  to  a  MySQL  server.     $connec6on  =  mysql_connect  ($server,  $username,  $query="CREATE  TABLE  kml_poi_sample  (lat   $password);   decimal(10,5)  NOT  NULL,  lng  decimal(10,5)  NOT   if  (!$connec6on)     NULL,  descrip6on    varchar(100)  NOT  NULL,  id   int(11)  NOT  NULL  auto_increment,  PRIMARY  KEY     {   (`id`))";      die(Not  connected  :    .  mysql_error());  mysql_query($query);   }  mysql_close();    echo  "Database  created";   //  Sets  the  ac6ve  MySQL  database.     $db_selected  =  mysql_select_db($database,  #new  values   $connec6on);  #=================   if  (!$db_selected)       {  $query  =  "INSERT  INTO  kml_poi_sample  VALUES   ($lat,$lng,$descrip6on,$maxid)";      die  (Cant  use  db  :    .  mysql_error());  $result=mysql_query($query);   }  if  (!$result)  {    //  Selects  all  the  rows          die(Error:    .  mysql_error());   $sql  =  select  id,name,  lat,  lng,  descrip6on  from  }   kml_poi_sample;          $result  =  mysql_query($sql);    
  41. 41. KML  from  MySQL  database  //  Create  output  $kml  =  array(<?xml  version="1.0"  encoding="UTF-­‐8"?>);   //  End  XML  file  $kml[]  =  <kml  xmlns="hTp://earth.google.com/kml/2.1">;   $kml[]  =    </Document>;  $kml[]  =  <Document>;   $kml[]  =  </kml>;  $kml[]  =  <Style  id="downArrowIcon">;   $kmlOutput  =  join("n",  $kml);  $kml[]  =  <IconStyle>;   header(Content-­‐type:  applica6on/vnd.google-­‐ earth.kml+xml);  $kml[]  =  <Icon>;   #header(Content-­‐type:  text/xml);  $kml[]  =  <href>hTp://maps.google.com/mapfiles/kml/pushpin/grn-­‐pushpin.png</href>;   echo  $kmlOutput;  $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>;  }  
  42. 42. KML  in  Google  Maps  §  hTps://maps.google.com/maps?q=hTp://service.fi/ map/kml/getkmlsample.php  
  43. 43. KML  in  Google  Earth  
  44. 44. 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  
  45. 45. 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>  
  46. 46. Response:  Opas<nsilta  12  Helsinki  
  47. 47. Demo:  Address  search  using  HTTP  POST  and  WFS  
  48. 48. 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:munic ipali6es    §  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    
  49. 49. 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  
  50. 50. 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/  
  51. 51. Coordinate  conversion  
  52. 52. Source  code  and  demo:  geoloca<on  and  coordinate  conversions  
  53. 53. OpenStreetMap  
  54. 54. OpenStreetMap  and  OpenLayers  w/  loca<on  
  55. 55. Source  code  and  demo:  Openstreetmap  and  the  current  loca<on  
  56. 56. 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  
  57. 57. Geometry  types  and  topological  rela<onships  
  58. 58. Spa<al  analysis  -­‐  func<ons   §  §  ST_Perimeter   ST_Point  §  ST_Area   §  ST_Intersec6on   §  ST_PointFromText  §  ST_AsBinary   §  ST_Intersects   §  ST_PointFromWKB  §  ST_AsText   §  ST_IsClosed   §  ST_PointN  §  ST_Boundary   §  ST_IsEmpty   §  ST_PointOnSurface  §  ST_Buffer   §  ST_IsRing   §  ST_PolyFromText  §  ST_Centroid   §  ST_IsSimple   §  ST_PolyFromWKB  §  ST_Contains   §  ST_IsValid   §  ST_Polygon  §  ST_ConvexHull   §  ST_Length   §  ST_Relate  §  ST_CoordDim   §  ST_LineFromText   §  ST_SRID  §  ST_Crosses   §  ST_LineFromWKB   §  ST_StartPoint  §  ST_Difference   §  ST_MLineFromText   §  ST_SymDifferenc  §  ST_Dimension   §  ST_MLineFromWKB   §  e  §  ST_Disjoint   §  ST_MPointFromText   §  ST_Touches  §  ST_Distance   §  ST_MPointFromWKB   §  ST_Transform  §  ST_EndPoint   §  ST_MPolyFromText   §  ST_Union  §  ST_Envelope   §  ST_MPolyFromWKB   §  ST_Within  §  ST_Equals   §  ST_NumGeometries   §  ST_WKBToSQL  §  ST_ExteriorRing   §  ST_NumInteriorRing   §  ST_WKTToSQL  §  ST_GeometryN   §  ST_NumPoints   §  ST_X  §  ST_GeometryType   §  ST_OrderingEquals   §  ST_Y  §  ST_GeomFromText   §  ST_Overlaps  §  ST_GeomFromWKB  §  ST_InteriorRingN  
  59. 59. 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);  
  60. 60. Spa<al  analysis  in  prac<ce  using  Spa<alite  database  
  61. 61. Tools  from  OpenGeo  §  hTp://live.osgeo.org  
  62. 62. 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  
  63. 63. 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…  
  64. 64. Open  Source  Map  Applica<on  Framework   www.oskari.org    
  65. 65. 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  
  66. 66. OSKARI  evolu<on  
  67. 67. 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  …  
  68. 68. Interested  in  knowing  more…?  §  hTp://www.uli.se/ogc-­‐nordic-­‐interoperability-­‐day/agenda  §  September  3rd  in  Stockholm  
  69. 69. Now:  any  ques<ons  and  comments?  Later  on:  firstname.lastname@nls.fi  

×