phpug - geo maps für papaya cms

41
05.06.09 Geo Maps - Martin Kelm 1 Geo Maps für papaya CMS

Upload: martin-kelm

Post on 31-May-2015

1.459 views

Category:

Technology


4 download

DESCRIPTION

PHPUG - Geo Maps für papaya CMS - 05.06.2009 >>> Downloads: - papaya CMS mit Patches http://goo.gl/NYtrH - Geo Maps http://goo.gl/JOFge - papaya CMS Handbuch http://goo.gl/yyaSX

TRANSCRIPT

Page 1: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 1

Geo Maps für papaya CMS

Page 2: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 2

Agenda

1. Google & Yahoo Maps

2. Weitere Schnittstellen

3. Geo Maps

4. Geo Maps Module

5. Quellen und Links

Page 3: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 3

1. Google & Yahoo Maps

Page 4: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 4

1.1. Google Maps

8. Februar 2005Standardansicht

April 2005Satellitenkarte

22. Juli 2005Hybridview

2. Januar 2006Straßenkarten

Page 5: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 5

1.1.1. Google Maps Karte

Page 6: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 6

1.1.2. Weitere Google Maps Kartentypen

Satellit Hybrid Physikalisch

Mars Mars (Höhenfarben) Mars (Infrarot)

Mond Mond (Höhenfarben) Sternenhimmel

Page 7: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 7

1.1.3. Google Maps API

Juni 2005: Version 1

3. April 2006: Version 2

11. Juni 2006:Geocoder

Neue Features u.a.Schnellerer Download

Eigene Karten-OverlaysSpeicheroptimierungen

Freier Dienst mit SchlüsselJavascript / XML

Eigene Daten / Punkteohne Werbung (bisher)*

Parser für Adressangabenund Koordinatenermittlung

* Alternative: Google Maps API Premier (Werbung kontrollierbar)

Page 8: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 8

1.1.4. Google Geocoder

Adresseingabe

Einzelner StringKeine Formatierungsvorgaben

unterstützt Abkürzungen

Adresse unterteilt in KomponenteneXtensible Address Language

unterstützt 200+ Länder

Adressausgabe

Koordinaten(Breitengrad / Längengrad)

Einfacher Geocoder

Client-seitiger CacheWeniger Geocoder-Anfragen

Mehr Performance

Bis zu 50.000 Anfragen pro API Key / Tag

HTTP / JavaScriptAnfrage

JavaScript Aufruf: GclientGeocoder()

Page 9: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 9

1.2. Yahoo Maps

Freier Dienst mit Application IDseit 03.11.2005 (Datum der Beta Version)

Page 10: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 10

1.2.1. Yahoo Maps API

Erste Version Sommer 2005(zeitgleich zu Google)

Nur für die USA(anfangs)

Mit Geocoder

Flash / Ajax

Page 11: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 11

2. Weitere Schnittstellen

Open Layers

Page 12: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 12

2.1. Google Earth

Virtueller 3D Globus

Verschiedene Kartenschichten

Austauschformat KML

Kostenlose Basisversion

Windows, Mac OS X, Linux, SymbianOS, iPhone OS

Page 13: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 13

2.2. Open Layers

Open Layers

Open Geospatial Consortium (2008)

offene Layer (über standardisierte Formate)

Geschlossene Formate (Microsoft, Google, Yahoo)

Page 14: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 14

2.2.1. Open Layers Beispiel 1

Zeichenfunktionen

Page 15: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 15

2.2.2. Open Layers Beispiel 2

GeoRSS mit Flickr Bildernvar newl = new OpenLayers.Layer.GeoRSS('georss.xml');map.addLayer(newl);

Page 16: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 16

2.2.2.1. GeoRSS Beispiel

GeoRSS nach W3C Standard

Page 17: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 17

2.2.3. Open Street Map

Sammlung von frei nutzbaren GeodatenWiki-ähnliche Datenbank mit Bearbeitungsfunktionen

Creative Commons Share-Alike 2.0

Page 18: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 18

3. Geo Maps

papaya CMS (RC1 und Nightly)

Entwicklung seit Mai 2007

Einbindung von Google Maps / Yahoo Maps

Verwaltung von Markierungen und Schlüsseln

Page 19: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 19

3.1. API Funktionen in Geo Maps

- Bedienelemente (de-)aktivieren / konfigurieren

- Kartentyp, -größe und Zoomstufe festlegen

- Karte ausrichten / zentrieren

- Beschreibungen über Mouse-Events

- Linien (Polyline)

- Statische Karten

- Kartenkoordinaten auslesen OnClick-Event / Beschreibung

Page 20: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 20

3.1.1. Weitere Beispiele

Kartenkoordinaten auslesen und in Formular übertragen. Polygon-Linien setzen

Page 21: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 21

4. Geo Maps Module

Geo Maps Modulübersicht im papaya CMS Backend

Page 22: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 22

4.1. Administration

Verwaltung von Markierungen

Verwaltung von Schlüsseln / Application IDs

Page 23: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 23

4.1.1. Markierungen verwalten

Page 24: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 24

4.1.2. Schlüssel / Application IDs verwalten

Google API Keys und / oder Yahoo Application IDs verwalten.

Page 25: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 25

4.2. Kartenboxen

Google Maps Box Yahoo Maps Box

Ausgabeklasse

Basisklasse

Konfiguration

Daten aus Konfiguration annehmen (setter)

Link-URLs und XML-Ausgabe (getter)

Page 26: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 26

4.2.1. - Kartenboxen konfigurieren

Einstellungen / Optionen zur Kartendarstellung

Page 27: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 27

4.2.2. - Kartenboxen konfigurieren

Markierungsdaten / Markierungseinstellungen

Page 28: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 28

4.2.3. - Kartenboxen konfigurieren

Weitere Konfigurationsmöglichkeiten

Page 29: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 29

4.2.4. Dynamische und statische Variante

Dynamisch mit Kontrollelementen Statisches Kartenbild

Statischer Kartenaufruf ->

URL maps.google.com/staticmap

Paramter- center = LAT,LNG- zoom = 15- size = 212x212- maptype = roadmap- markers = LAT,LNG,red- key = API-KEY

Page 30: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 30

4.2.4.1. Dynamischer Kartenaufruf (1)

1. Browserkompatibilität prüfen:GBrowserIsCompatible() -> TRUE / FALSE

2. Div-Element im Dokument ermitteln:var mapElement = document.getElementById("map");

3.Kartenobjekt mit bestimmter Größe erzeugen:var googleMap = new Gmap2( mapElement, {'size' : new GSize(width, height)});

4. Kartentyp definieren:googleMaps.setMapType(mapTypeConstant);

API JavaScript mit API-Key laden

Page 31: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 31

4.2.4.1. Dynamischer Kartenaufruf (2)

5. Kontrollelemente setzen:googleMap.addControl(new GLargeMapControl());

6. Punktobjekt erzeugen:var point = new GLatLng(

parseFloat(latitude), parseFloat(longitude));

7. Kartezentrieren:googleMaps.setCenter(point);

8. Markierung setzen:var marker = new GMarker(point);

(weitere Parameter für eigene Icon-Bilder möglich)googleMaps.addOverlay(marker);

Page 32: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 32

4.3. - Konnektor

Methoden:

Liste von Ordnern als Auswahlbox

Markierung hinzufügen

Markierung löschen

Basisklasse Klasse einesFremdmoduls

Konnektorklasse

Page 33: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 33

4.3.1. - Beispiel zum Konnektor

Karten- und spezielle Formularbox

Überladenes Klick-Ereignis

M2

M1

Geo Maps Konnektor

Geo Maps Basisklasse

Geo Maps Ausgabeklasse

function coorModeAction(x, y) { if (lastMarker != null) googleMaps.removeOverlay(lastMarker); lastMarker = setMarker(new GLatLng(y, x)); locationInput.value = y+','+x; }

Page 34: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 34

4.4. Geo Maps Datenbanktabellen

Page 35: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 35

4.4.1. Ausgabe von Markierungsdaten

KML

Beschreibungin HTML

XMLHttpRequest

Styles fürGoogle Earth

Page 36: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 36

4.4.1.1. Markierungsdaten exportieren

Exportfunktionim Backend

Oder als Download im KML Ausgabemodus(Markierungsdaten)

KML mit Styles für Markierungsicon

Page 37: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 37

4.5. MySQL Spatial Extensions

Funktionen:Erzeugung, Speicherung und Analyse von

geographischen Kenndaten

Seit MySQL 4.1 (für MyISAM)

seit 5.0.16 auch InnoDB, NDB, BDB und ARCHIVE

Page 38: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 38

4.5.1. SE Klassenhierarchie

Point: 0-dimensionalCurve: 1-dimensional

Surface: 2-dimensional

GeometryCollection:Zusammenstellungen

verschiedener Geometrien

Page 39: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 39

4.5.2. Geo Maps Funktionen für SE

- Datenbanktabellen anlengen(für Punkte und Polygone)

- Punkte hinzufügen / entfernen

- Polygone hinzufügen / entfernen

- nächst gelegenen Punkt ermitteln

- liegt Punkt A in Polygon X?

Basisklasse für Spatial Extensions

Spaltentyp: polygonIndex: SPATIAL KEY

Spaltentyp: pointIndex: SPATIAL KEY

Page 40: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 40

4.5.3. SE Datentabellen

Erweiterungstabellen für MySQL Spatial Extensions bzw. Polygon- und Punktdaten

Page 41: PHPUG - Geo Maps für papaya CMS

05.06.09 Geo Maps - Martin Kelm 41

5. Quellen und weiterführende Links

martinkelm.deen.wikipedia.org/wiki/Google_Mapsen.wikipedia.org/wiki/Google_Earthen.wikipedia.org/wiki/Yahoo_Mapsen.wikipedia.org/wiki/Open_Layersopenlayers.org/dev/exampleswww.georss.org/Main_Pagedev.mysql.com/doc/refman/5.0/en/spatial-extensions.htmlcode.google.com/apis/maps/documentation/reference.htmldeveloper.yahoo.com/maps/ajax/V2/reference.htmlshrt.ws / weisse-liste.de

ENDE