20150330 - victor gau - maps

download 20150330 - victor gau - maps

of 30

  • date post

    16-Jul-2015
  • Category

    Software

  • view

    82
  • download

    3

Embed Size (px)

Transcript of 20150330 - victor gau - maps

Creating Map Applications using Python

Victor Gau20150330

Outline

Static Map Applications

Interactive Map Applications

Real Time Google Earth Applications

Python development web server

python -m CGIHTTPServer

Static Map Applications

Google Static Maps API

Google Static Maps API Google JavaScript

Google HTTP

https://developers.google.com/maps/documentation/staticmaps/

Google Static Maps API

http://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=13&size=600x300&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Ccolor:red%7Clabel:C%7C40.718217,-73.998284&sensor=false

Google Static Maps API

DEMO

Interactive Map Applications

Folium

Mapping using Leaflet.js library.

Built-in tilesets from OpenStreetMap, Mapbox, and Stamen

Supports custom tilesets with Mapbox or Cloudmade API keys.

To install => pip install folium

https://folium.readthedocs.org/en/latest/

Base Maps

import foliummap = folium.Map(location=[45.5236, -122.6750])map.create_map(path='osm.html')

Markers

Simple Markers

Circle Markers

Polygon Markers

http://folium.readthedocs.org/en/latest/#markers

Tilesets

OpenStreetMap

Mapbox Bright (Limited levels of zoom)

Mapbox Control Room (Limited levels of zoom)

Stamen Terrain

Stamen Toner

http://folium.readthedocs.org/en/latest/#tilesets

DEMO

DEMO

Real Time Google Earth Applications

Google Earth

https://www.google.com/earth/

KML

https://developers.google.com/kml/documentation/https://developers.google.com/kml/documentation/kmlreference

in KML

https://developers.google.com/kml/documentation/cameras

NetworkLink Concept

A network link contains a element with an (a hypertext reference) that loads a file.

The can be a local file specification or an absolute URL. Despite the name, a does not necessarily load files from the network.

KML Interactive Sampler

DEMO

Google Earth API (Deprecated)

NASA WorldWind

Cesium.js

http://cesiumjs.org/

Thank You!

Flask

python micro web framework

pip install flask

http://flask.pocoo.org/

http://flask.pocoo.org/docs/0.10/quickstart/#quickstart

Flask Hello World

from flask import Flaskapp = Flask(__name__)

@app.route("/")def hello():return "Hello World!"

if __name__ == "__main__":app.run()

Rendering Template

from flask import render_template

@app.route('/hello/')@app.route('/hello/')def hello(name=None):return render_template('hello.html', name=name)

Hello from Flask{% if name %}Hello {{ name }}!{% else %}Hello World!{% endif %}

jinja2

template engine

http://jinja.pocoo.org/docs/dev/

{% block content %}, {% endblock %}

{% extends index.html %}

{{ variable }}

{{ variable | filters }}

{# comments #}