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. 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. 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. 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/
18. 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))
20. 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)
22. 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
23. 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
25. 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
27. 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
28. WMS
example
§ hTps://ws.nls.fi/rasteriaineistot/test/index.html
33. 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/
38. Google
Maps
§ Easy
way
to
build
interac6ve
data
visualiza6ons
on
a
map
and
loca6on-‐based
apps
§ hJps://developers.google.com/maps/documentaBon/
javascript/reference
41. 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
('Can't
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);
45. 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
50. 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
51. 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/
57. 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
60. 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);
66. 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
68. 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
…
69. Interested
in
knowing
more…?
§ hTp://www.uli.se/ogc-‐nordic-‐interoperability-‐day/agenda
§ September
3rd
in
Stockholm