Fast Map Interaction
                               Without Flash
                        Tom MacWright @tmcw from MapBox @mapbox




Wednesday, April 20, 2011
Solutions That Aren’t



Wednesday, April 20, 2011
Flash is a dead end

                    • Hopefully this goes without saying
                    • Maps are especially mobile
                    • We don’t tolerate closed-source
                            components




Wednesday, April 20, 2011
Vectors aren’t there yet
                    • Internet Explorer still owns 45% of the
                            market
                    • Polymaps is working on IE9
                    • Even bleeding-edge browsers are still in
                            early stages of optimization
                    • Passable for points, but rendering
                            OpenStreetMap in-browser?


Wednesday, April 20, 2011
Polygons in-Browser
                    • GeoJSON is nifty but bandwidth-inefficient
                    • Browser APIs are weak (VML?)
                    • Calculating polygon collisions is code-heavy
                            and slow
                    • Simplifying polygons to speed up browsers
                            doesn’t cut it


Wednesday, April 20, 2011
Wednesday, April 20, 2011
Wednesday, April 20, 2011
WMS GetFeatureInfo




Wednesday, April 20, 2011
WMS GetFeatureInfo

                    • Not cacheable: requires a running web
                            server
                    • Hover interaction near-impossible
                    • Just as friendly and great as WMS itself


Wednesday, April 20, 2011
“Designing Around It”

                    • Zooming out makes points disappear?
                    • Clustering for performance reasons?
                    • Restricting panning?


Wednesday, April 20, 2011
Inspiration: Google



Wednesday, April 20, 2011
Wednesday, April 20, 2011
Wednesday, April 20, 2011
Wednesday, April 20, 2011
• Awesome idea!
                    • Undocumented
                    • Only supports points
                    • A single type of data


Wednesday, April 20, 2011
http://bit.ly/utfgrid

                            UTFGrid
Wednesday, April 20, 2011
Wednesday, April 20, 2011
Rasterized Tiles
                           +
                Pixel-Driven Interaction

Wednesday, April 20, 2011
Wednesday, April 20, 2011
Wednesday, April 20, 2011
Wednesday, April 20, 2011
JSON, in the nick of time!




Wednesday, April 20, 2011
where am I, in this tile?




Wednesday, April 20, 2011
Wednesday, April 20, 2011
Wednesday, April 20, 2011
letters are numbers after all




Wednesday, April 20, 2011
Wednesday, April 20, 2011
application-specific formatting




Wednesday, April 20, 2011
Hooray!




Wednesday, April 20, 2011
Size Optimizations

                    • One UTF-8 character per feature
                    • 256px / 256px tiles
                    • 2x2 pixel grid (users aren’t pixel-precise)
                    • gzip

Wednesday, April 20, 2011
Lower bound

                               256 2   1kb
                             (    ) ∗       = 16kb
                                2     1024b
                                    Upper bound

                              256 2   1kb
                            (    ) ∗       ∗ 2 = 32kb
                               2     1024b


Wednesday, April 20, 2011
non-scientific survey of observed file size
                                        (aka, thanks, gzip)

                       3


                  2.25


    #req            1.5


                  0.75


                       0
                             4   5   6   7   8   9   10   11   12   13   14   15   16   17   18

                                                     in kb
Wednesday, April 20, 2011
Wednesday, April 20, 2011
• Grid size is limited by the number of pixel
                            blocks, so zooming out to the US actually
                            can work

                    • The grid also works for points, and
                            lines too




Wednesday, April 20, 2011
13k points




Wednesday, April 20, 2011
Speed
                    • Once you have the grid, the mouse
                            coordinate, and the tile coordinate, there
                            are no loops required to find the grid
                            feature, if any.
                    • Grid computations are typically outweighed
                            by the time taken to display tooltips
                    • Once a grid is generated, it doesn’t need to
                            change. It could be a file sitting on S3.


Wednesday, April 20, 2011
... about that ‘application specific formatting’




                    • Designed to be usable outside of a browser
                    • And much more than just tooltips
                    • You get ‘just data’ from the server, not
                            HTML




Wednesday, April 20, 2011
// Bring your own JavaScript
                            function (options, data) {
                                ...
                                return formatted_output;
                            }




Wednesday, April 20, 2011
function (options, data) {
                if (options.format == 'teaser') {
                    return '<h1>' + data.NAME + '</h1>';
                } else if (options.format == 'full') {
                    return '<h1>' + data.NAME + '</h1>' + data.AREA;
                }
            }




Wednesday, April 20, 2011
“The Implementation”



Wednesday, April 20, 2011
Generating: Mapnik
                                      http://mapnik.org/

                    • Mapnik is everyone’s favorite world-beating
                            open source map renderer
                    • Initially we rendered the map, and then
                            queried a 642 grid. It was slow.
                    • Dane Springmeyer has been writing a grid
                            renderer deep in AGG which is way faster.



Wednesday, April 20, 2011
Parsing: APIs
                              http://github.com/mapbox/wax


                    •       Google Maps API v3
                    • OpenLayers
                    • Modest Maps


Wednesday, April 20, 2011
• (let’s do it!)




Wednesday, April 20, 2011
(sidenote: APIs)

                    • Grids reduce the role of mapping APIs:
                            their parsing task is reduced to <200 lines
                    • Do one thing, and do it well: provide a tiling
                            interface
                    • Thus, for our usage,
                            Modest Maps > OpenLayers.



Wednesday, April 20, 2011
Making Grids:
                                  TileMill
                            http://tilemill.com/


Wednesday, April 20, 2011
Wednesday, April 20, 2011
Wednesday, April 20, 2011
Using Grids
                 TileStream, iPad, & Wax


Wednesday, April 20, 2011
Or, make your own?

                    • Grid implementation in Mapnik core - with
                            bindings to nodejs and Python (LGPL &
                            BSD licensed)
                    • Grid reader implementations in Wax,
                            supporting Google Maps, OpenLayers, and
                            Modest Maps (BSD licensed)



Wednesday, April 20, 2011
• No seriously, it’s open source.




Wednesday, April 20, 2011
URLS!

                    • http://mbtiles.org/ (read the full spec)
                    • http://tilemill.com/
                    • http://github.com/mapbox/


Wednesday, April 20, 2011
Rough Edges!

                    • Can’t highlight features yet
                    • More APIs! (except Bing, because of TOS)
                    • Formatter spec needs security spec -
                            currently relies on trust
                    • Contributions welcome!

Wednesday, April 20, 2011
Thanks!
                                 @mapbox

                            @tmcw Tom MacWright


Wednesday, April 20, 2011

More Related Content

PDF
Alternative Mapping on iOS
PDF
The State of Front End Web Development 2011
PDF
Javascript FTW
PPT
адресаты любовной лирики
PPTX
Successful Mulit Generation Volunteer Programs
PPT
Чехов А.П.
PPT
методическое руководство учителю
PDF
GeoDC: Better data for better elections in Afghanistan
Alternative Mapping on iOS
The State of Front End Web Development 2011
Javascript FTW
адресаты любовной лирики
Successful Mulit Generation Volunteer Programs
Чехов А.П.
методическое руководство учителю
GeoDC: Better data for better elections in Afghanistan

Similar to Fast Map Interaction without Flash (20)

PDF
Mapnik2 Performance, September 2011
PDF
Web mapping with vector data. Is it the future ? 2012
PDF
Taiwan Web Standards Talk 2011
PDF
HTML5 and jQuery for Flex Developers
PDF
In the land of the blind the squinter rules
PDF
Data Viz Barcamp, Amsterdam
PDF
Back To The Future
PDF
Cloud is such stuff as dreams are made on
PDF
A Look at the Future of HTML5
PDF
Progressive Advancement in Web8
PDF
Hawaii Pacific GIS Conference 2012: Internet GIS - Create Your Own Google Lik...
PDF
PDF
Sean coates fifty things and tricks, confoo 2011
PDF
Persistence Smoothie: Blending SQL and NoSQL (RubyNation Edition)
PDF
Persistence Smoothie
PDF
DjangoCon 2009 Keynote
PDF
HTML XHTML HTML5
PDF
Tim stone.html5.rjug.20110316
PDF
GeoDjango in a nutshell
PDF
Web Standards @ Opera Talk Oslo
Mapnik2 Performance, September 2011
Web mapping with vector data. Is it the future ? 2012
Taiwan Web Standards Talk 2011
HTML5 and jQuery for Flex Developers
In the land of the blind the squinter rules
Data Viz Barcamp, Amsterdam
Back To The Future
Cloud is such stuff as dreams are made on
A Look at the Future of HTML5
Progressive Advancement in Web8
Hawaii Pacific GIS Conference 2012: Internet GIS - Create Your Own Google Lik...
Sean coates fifty things and tricks, confoo 2011
Persistence Smoothie: Blending SQL and NoSQL (RubyNation Edition)
Persistence Smoothie
DjangoCon 2009 Keynote
HTML XHTML HTML5
Tim stone.html5.rjug.20110316
GeoDjango in a nutshell
Web Standards @ Opera Talk Oslo
Ad

More from Development Seed (17)

PPTX
Rasters are not Monsters - GeoMTL 2019
PDF
Cartography with TileMill, PostGIS, and OpenStreetMap
PDF
Nonprofit Mapping at Net2DC Meetup
PDF
Famine Mapping with USAID
PDF
Tilemill: Making Custom Transit Maps
PDF
Transparency camp
PDF
Tech@State Preview of Designing Custom Maps with TileMill
PDF
ReliefWeb Drupal 7 Build Plan
PDF
IBM Drupal Users Group Discussion on Managing and Deploying Configuration
PDF
Offline Mapping: International Crisis
PDF
Aegir one drupal to rule them all
PDF
Backstage with Drupal localization- Part 2
PDF
For every site a make file
PDF
Go real time with pubsubhubbub and feeds
PDF
Drupal Distributions: The Dos and Don'ts:
PDF
Open Atrium
PDF
Opening Large Data Sets
Rasters are not Monsters - GeoMTL 2019
Cartography with TileMill, PostGIS, and OpenStreetMap
Nonprofit Mapping at Net2DC Meetup
Famine Mapping with USAID
Tilemill: Making Custom Transit Maps
Transparency camp
Tech@State Preview of Designing Custom Maps with TileMill
ReliefWeb Drupal 7 Build Plan
IBM Drupal Users Group Discussion on Managing and Deploying Configuration
Offline Mapping: International Crisis
Aegir one drupal to rule them all
Backstage with Drupal localization- Part 2
For every site a make file
Go real time with pubsubhubbub and feeds
Drupal Distributions: The Dos and Don'ts:
Open Atrium
Opening Large Data Sets
Ad

Recently uploaded (20)

PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
CloudStack 4.21: First Look Webinar slides
PDF
Getting started with AI Agents and Multi-Agent Systems
PPT
Geologic Time for studying geology for geologist
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
1 - Historical Antecedents, Social Consideration.pdf
DOCX
search engine optimization ppt fir known well about this
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PPTX
Benefits of Physical activity for teenagers.pptx
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
Developing a website for English-speaking practice to English as a foreign la...
PPTX
Modernising the Digital Integration Hub
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Five Habits of High-Impact Board Members
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PPTX
Chapter 5: Probability Theory and Statistics
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
A contest of sentiment analysis: k-nearest neighbor versus neural network
CloudStack 4.21: First Look Webinar slides
Getting started with AI Agents and Multi-Agent Systems
Geologic Time for studying geology for geologist
Assigned Numbers - 2025 - Bluetooth® Document
A novel scalable deep ensemble learning framework for big data classification...
1 - Historical Antecedents, Social Consideration.pdf
search engine optimization ppt fir known well about this
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
Benefits of Physical activity for teenagers.pptx
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Developing a website for English-speaking practice to English as a foreign la...
Modernising the Digital Integration Hub
Enhancing emotion recognition model for a student engagement use case through...
Hindi spoken digit analysis for native and non-native speakers
Five Habits of High-Impact Board Members
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Chapter 5: Probability Theory and Statistics
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor

Fast Map Interaction without Flash

  • 1. Fast Map Interaction Without Flash Tom MacWright @tmcw from MapBox @mapbox Wednesday, April 20, 2011
  • 3. Flash is a dead end • Hopefully this goes without saying • Maps are especially mobile • We don’t tolerate closed-source components Wednesday, April 20, 2011
  • 4. Vectors aren’t there yet • Internet Explorer still owns 45% of the market • Polymaps is working on IE9 • Even bleeding-edge browsers are still in early stages of optimization • Passable for points, but rendering OpenStreetMap in-browser? Wednesday, April 20, 2011
  • 5. Polygons in-Browser • GeoJSON is nifty but bandwidth-inefficient • Browser APIs are weak (VML?) • Calculating polygon collisions is code-heavy and slow • Simplifying polygons to speed up browsers doesn’t cut it Wednesday, April 20, 2011
  • 9. WMS GetFeatureInfo • Not cacheable: requires a running web server • Hover interaction near-impossible • Just as friendly and great as WMS itself Wednesday, April 20, 2011
  • 10. “Designing Around It” • Zooming out makes points disappear? • Clustering for performance reasons? • Restricting panning? Wednesday, April 20, 2011
  • 15. • Awesome idea! • Undocumented • Only supports points • A single type of data Wednesday, April 20, 2011
  • 16. http://bit.ly/utfgrid UTFGrid Wednesday, April 20, 2011
  • 18. Rasterized Tiles + Pixel-Driven Interaction Wednesday, April 20, 2011
  • 22. JSON, in the nick of time! Wednesday, April 20, 2011
  • 23. where am I, in this tile? Wednesday, April 20, 2011
  • 26. letters are numbers after all Wednesday, April 20, 2011
  • 30. Size Optimizations • One UTF-8 character per feature • 256px / 256px tiles • 2x2 pixel grid (users aren’t pixel-precise) • gzip Wednesday, April 20, 2011
  • 31. Lower bound 256 2 1kb ( ) ∗ = 16kb 2 1024b Upper bound 256 2 1kb ( ) ∗ ∗ 2 = 32kb 2 1024b Wednesday, April 20, 2011
  • 32. non-scientific survey of observed file size (aka, thanks, gzip) 3 2.25 #req 1.5 0.75 0 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 in kb Wednesday, April 20, 2011
  • 34. • Grid size is limited by the number of pixel blocks, so zooming out to the US actually can work • The grid also works for points, and lines too Wednesday, April 20, 2011
  • 36. Speed • Once you have the grid, the mouse coordinate, and the tile coordinate, there are no loops required to find the grid feature, if any. • Grid computations are typically outweighed by the time taken to display tooltips • Once a grid is generated, it doesn’t need to change. It could be a file sitting on S3. Wednesday, April 20, 2011
  • 37. ... about that ‘application specific formatting’ • Designed to be usable outside of a browser • And much more than just tooltips • You get ‘just data’ from the server, not HTML Wednesday, April 20, 2011
  • 38. // Bring your own JavaScript function (options, data) { ... return formatted_output; } Wednesday, April 20, 2011
  • 39. function (options, data) { if (options.format == 'teaser') { return '<h1>' + data.NAME + '</h1>'; } else if (options.format == 'full') { return '<h1>' + data.NAME + '</h1>' + data.AREA; } } Wednesday, April 20, 2011
  • 41. Generating: Mapnik http://mapnik.org/ • Mapnik is everyone’s favorite world-beating open source map renderer • Initially we rendered the map, and then queried a 642 grid. It was slow. • Dane Springmeyer has been writing a grid renderer deep in AGG which is way faster. Wednesday, April 20, 2011
  • 42. Parsing: APIs http://github.com/mapbox/wax • Google Maps API v3 • OpenLayers • Modest Maps Wednesday, April 20, 2011
  • 43. • (let’s do it!) Wednesday, April 20, 2011
  • 44. (sidenote: APIs) • Grids reduce the role of mapping APIs: their parsing task is reduced to <200 lines • Do one thing, and do it well: provide a tiling interface • Thus, for our usage, Modest Maps > OpenLayers. Wednesday, April 20, 2011
  • 45. Making Grids: TileMill http://tilemill.com/ Wednesday, April 20, 2011
  • 48. Using Grids TileStream, iPad, & Wax Wednesday, April 20, 2011
  • 49. Or, make your own? • Grid implementation in Mapnik core - with bindings to nodejs and Python (LGPL & BSD licensed) • Grid reader implementations in Wax, supporting Google Maps, OpenLayers, and Modest Maps (BSD licensed) Wednesday, April 20, 2011
  • 50. • No seriously, it’s open source. Wednesday, April 20, 2011
  • 51. URLS! • http://mbtiles.org/ (read the full spec) • http://tilemill.com/ • http://github.com/mapbox/ Wednesday, April 20, 2011
  • 52. Rough Edges! • Can’t highlight features yet • More APIs! (except Bing, because of TOS) • Formatter spec needs security spec - currently relies on trust • Contributions welcome! Wednesday, April 20, 2011
  • 53. Thanks! @mapbox @tmcw Tom MacWright Wednesday, April 20, 2011