Thursday, September 2, 2010 Create Your Own Google-like Maps Michael Baker Senior Consultant
Nov 01, 2014
Thursday, September 2, 2010
Create Your Own Google-like Maps Michael Baker
Senior Consultant
Thursday, September 2, 2010
Why Build a Google-like Mapping Application?
Have you ever:
– Wanted your mapping application to have the same navigation as Google Maps?
– Wanted the same speed and performance as Google Maps?
– Wanted to see your vector data in Google Maps?
– Wanted to see your imagery in Google Maps?
2
Thursday, September 2, 2010
History of Web Mapping: Pre - 2003
3
History of Maps on the Web (2003)
Autodesk's M apGuide
ESRI's M ap Objects
TerraServer USA
Netscape browser
(M osaic)
Intergraph's GeoM edia
WebM ap 1.0
M apQuest
Java 1.0
The National Atlas of
Canada
Xerox PARC M apserver
HTM L 1.0
Birth of the WWW
HTTP 1.0
Flash Player 5
ESRI's ArcIM S 3.0
SVG 1.0
First web browser
1989 1991 1993 1995 1997 1999 2001 2003
Thursday, September 2, 2010
History of Web Mapping: 2003 – Present
4
Maps on the Web 2003 to Present
Term Web 2.0 introduced
Windows Live Local
Google M aps API
Yahoo! M aps API
SVG 1.2
Firefox 1.5 (native SVG)
Google Earth
Google M aps
2003 2004 2005 2006 2007
Thursday, September 2, 2010
How Does Google Maps Work?
5
Thursday, September 2, 2010
Development History of Google Maps
Google Maps first started as a software application developed by Lars and Jens Rasmussen
for the company Where2.
In October 2004 the company was acquired by Google where it transformed into the web
application Google Maps.
The application was first announced on the Google Blog on February 8, 2005.
It originally only supported users of Internet Explorer and Mozilla web browsers, but support
for Opera and Safari was added on February 25, 2005.
Currently Internet Explorer 6.0+, Firefox 2.0+, Safari 3.1+, and Google Chrome are supported.
It was in beta for six months before becoming part of Google Local on October 6, 2005.
6
Thursday, September 2, 2010
Performance - It Is All About the Cache!
The map within Google Maps consist as a set of tiles
These tiles cover the entire earth at each zoom level
Tiles exist for each map type:
– Street map
– Satellite map
– Hybrid map
– Physical map
7
Thursday, September 2, 2010
How Much Cache?
Tiles do not cover all regions at all zoom levels
Different areas of the map may contain tiles at varying resolutions and therefore varying zoom
levels
Tile coverage of any map type varies based on location
– For example, many areas of the Pacific Ocean do not appear at high zoom levels, while Honolulu may
have very detailed maps
8
Thursday, September 2, 2010
Zoom Levels
At the lowest zoom level (0), one tile represents the entire earth
Each succeeding zoom level divides the map into 4N tiles, where N refers to the zoom level
– Zoom level 1, divides the world up into a 2x2 grid for a total of 4 tiles
– Zoom level 2, divides up the world into a 4x4 grid for a total of 16 tiles
9
Thursday, September 2, 2010
Spherical Mercator
The coordinates in Google Maps and which are presented to the users is Latitude/Longitude
in WGS84 Datum
For tile publishing, a Mercator projection is used.
Why Mercator?
– Mercator projection significantly distorts scale and area
– It has two important properties:
It is a conformal projection
– Preserves the shape of relatively small objects
It is a cylindrical projection
– North and south are always straight up and down, and west and east are always straight left and
right
Since the Mercator projection goes to infinity at the poles, it does not actually show the entire
world.
– Maximum latitude is approximately 85.05 degrees
10
Thursday, September 2, 2010
Addressing Tiles
There are three coordinate systems that Google uses:
– Pixel coordinate referencing a point on an image tile
– Tile coordinates referencing a tile within a tile layer
– The zoom layer, which defines the total number of tiles
This is often referred to as Google XYZ
11
Thursday, September 2, 2010
Why Would You Not Use Google?
Why as a website developer, who controls all aspects of your site, would you allow a big alien
blob on your site?
– You accept whatever colors, fonts and map layers Google chooses
– You do add some custom markers and overlays but fundamentally, the map itself is out of your hands
Google’s choices about what to display on the map may not work for your application
You are limited to Google API’s terms and conditions
You are limited to what Google wants to implement
You so have much invested in your data
12
Thursday, September 2, 2010
If Not Google Maps, What?
The key is to understand the map
stack
Modern online mapping applications
adhere to this architecture
There are four major components of
the map stack:
– Browser UI
– Tile Cache
– Map Server
– Geospatial data
13
Geospatial
Data
Map Server
Tile Cache
Browser UI
HTTP Server
Tile Server
Application Server
Thursday, September 2, 2010
Tile Cache
A tile cache is a server that sits between the browser and the map server.
It checks to see if a requested map tile is already generated so it can be served up quickly.
If the map tile is not already generated, the tile cache gets it from the map server and saves it
for future requests.
The tile cache may be considered as one half of a layer in the map stack.
It is not technically required.
14
Thursday, September 2, 2010
Map Server
A map server is an application that takes geospatial data as input and renders graphical
output.
The map server allows the user creative control of the final map.
Map servers can be exposed directly to the internet or can be hidden from direct access by
the tile cache layer in the stack.
15
Thursday, September 2, 2010
Geospatial Data
The building blocks of any mapping application are the databases that define the points, lines,
and polygons that represent real-world places, roads, and areas.
16
Thursday, September 2, 2010
How Do I Create a Google Maps-like Application
17
Thursday, September 2, 2010
Performance – Need Cache
Map caching is a very effective way to make maps run faster.
When you create a map cache, the server draws the entire map at several different scales,
and stores copies of the map images.
The server can then distribute these images whenever someone asks for a map.
18
Thursday, September 2, 2010
Tile Caching Review
Advantages
– Performance
– Quality
Performance isn’t affected by how much detail is on the map
– Industry standard
Tile caching is becoming an industry standard
Disadvantages
– Takes time to generate the tiles
When should you cache?
– If the data you see on the map needs to be live, with no time delay acceptable, then caching is not
appropriate.
Although the cache represent pictures of the data, you can still run operations on your map
and your data.
These operations will query the server and return the results.
Results will be drawn on top of the cached image.
19
Thursday, September 2, 2010
Thinking about Cache
Need to think about the layers of the map
Design your map for the scale to be viewed.
Utilize the style properties at each scale.
Choose your largest scale carefully. This will show the most detail and take the longest to
process.
20
Thursday, September 2, 2010
Utilize Open Source Tools
Remember the map stack
– Browser UI
– Tile Cache
– Web Server
– Geospatial Data
There are a couple of commercial /
open source tile caching solutions
21
Geospatial
Data
Web Server
Tile Cache
Browser UI
HTTP Server
Tile Server
Application Server
Thursday, September 2, 2010
Summary
Google Maps is a great application. However, it has limitations.
Organizations have spent a tremendous amount of money collecting and maintaining their
data.
It is not difficult to create your own Google-like mapping application.
The key is to understand the elements of the map stack.
Remember scale and layer definitions.
22
Thursday, September 2, 2010
Questions?
23