Maps APIs Overview

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Maps APIs Overview - Presentation Transcript

    1. Google Maps API Rajdeep Dua
    2. Why Maps?
      • The other failsafe way of organizing information:
      • 0 — Search.
      • 1 — Order chronologically.
      • 2 — Draw a map.
      • Putting it on a map is a great way to organize information.
    3. Google Maps APIs
      • A library of "HTML elements" for places.
      • An "HTML element" with augmented behavior.
    4. APIs at a Glance
    5. Google Maps 101: Adding a map to your page
        • 1. Create/size a map DIV
        • 2. Load the Maps API JS
        • 3. Create + center the map
      Javascript Key: <html>   <head>   <script type=&quot;text/javascript&quot; src=&quot;http://maps.google.com/maps?file=api&v=2&key=ABQ...c&quot;></script>   <script> function createMap() {    var map = new GMap2(document.getElementById(&quot;map&quot;));    map.setCenter(new GLatLng(37.44, -122.14), 14); }   </script>   </head>   <body onload=&quot;createMap()&quot; onunload=&quot;GUnload()&quot;>    <div id=&quot;map&quot; style=&quot;width:100%;height:50%&quot;></div>   </body> </html> CSS HTML
    6. Google Maps 101: Adding a marker var marker = new GMarker(new GLatLng(lat, lon));
        • 1. Initialise the marker
      GEvent.addListener(marker, 'click', function() {    marker.openInfoWindowHtml('<h1>Hi!</p>'); });
        • 2. Make a bubble pop up when clicked
      map.addOverlay(marker);
        • 3. Display the marker
      Javascript Key: CSS HTML
    7. Google Maps 101: Adding a line var latOffset = 0.001; var lngOffset = 0.001;
        • 1. Initialise lat/lon offset from our marker (optional)
      var line = new GPolyline([new GLatLng(lat, lng-lngOffset), new GLatLng(lat, lng+lngOffset)]);
        • 2. Create the line
      map.addOverlay(line);
        • 3. Display the line
      Javascript Key: CSS HTML
    8. Google Maps 101 : Adding a polygon var polygon = new GPolygon([ new GLatLng(lat, lng - lngOffset), new GLatLng(lat + latOffset, lng), new GLatLng(lat, lng + lngOffset), new GLatLng(lat - latOffset, lng), new GLatLng(lat, lng - lngOffset)], '#f33f00', 5, 1, '#ff0000', 0.2);
        • 1. Create the polygon and set line / fill properties
      map.addOverlay(polygon);
        • 2. Display the polygon
      Javascript Key: CSS HTML
    9. Custom Maps
        • When markers/polys aren't the right solution for visualizing data on a map
        • Alternate solutions: 
          • Single image overlays
          • Tile layers
      What We'll Talk About
    10. Markers and Polylines
        • The typical way of visualizing data:
    11. Markers and Polylines
        • Using markers and polylines for maps can be a great way of visualizing and interacting with data - as long as you don’t have too many.
    12. Markers and Polylines
        • The maximum number of markers and polylines change depending on the browser and computer running the page. Too many, and this happens:
    13. Markers and poly lines work fine for smaller, less data intensive applications. For anything more detailed, image overlays will be a more workable solution. Markers and Polylines: Conclusion
    14. Image Overlay Types
        • Single Image Overlays
        • ( GGroundOverlay )
        • Tiled Image Overlays
        • ( GTileLayer )
    15. Single Image Overlays
        • In the API, usually use GGroundOverlay to achieve this
        • Basic concept: Stretch an image to fit a bounding box
    16. Single Image Overlays: Examples
      • Various Uses:
        • Erupting Volcano
        • Historical New Jersey Map
        • US Counties
        • Also used Extensively for Simple Campus Maps
      • With each of these examples, play with the zoom level and notice the degradation in image quality.
      • DEMO : IIM Lucknow Campus Map
      • .
    17. Single Image Overlays: Conclusion Single Image Overlays work well for areas that consist of a single map viewport and a single zoom setting. It’s easy to implement but suffers from performance issues and limited options. Applications that require larger coverage and multi-resolution data need a more robust solution.
    18. Tiled Image Overlays
        • In the API, usually use GTileLayer to achieve this
        • Basic concept: Load tiles of constant size at each zoom level. The standard Google Maps map types are implemented this way.
      • Advantages:
        • Extremely Efficient
        • Runs easily on all map capable browsers
        • Works equally well at each zoom level
        • Capable of displaying large areas
      • Disadvantages:
        • Somewhat complex to generate
        • More difficult to understand
        • Typically requires a robust server
    19. Tiled Image Overlays: Tile Structure
        • The tiling system consists of a series of images with a dimension of 256x256 pixels.
        • Each successive zoom level divides the previous zoom level’s images into four new images, resulting in a map that displays one forth the area at twice the resolution of the previous level.
        • Zoom level 0 is the lowest level, there is no theoretical upper zoom level limit.
      • Try zooming and panning on Google Maps with &quot;Outline Images&quot; enabled to see this in action.
    20. Tiled Image Overlays: Tile Structure
        • The world as one tile: zoom 0 (4**0)
      Pixels: Top (y): 0 Left (x): 0 Bottom: 255 Right: 255 Tile No.: x:0 y:0
    21. Tiled Image Overlays: Tile Structure
        • The world as four tiles: zoom 1 (4**1)
      Tile No.: x:0 y:0 Pixels: Top (y): 0 Left (x): 0 Bottom: 255 Right: 255 Tile No.: x:0 y:1 Pixels: Top (y): 256 Left (x): 0 Bottom: 511 Right: 255 Tile No.: x:1 y:0 Pixels: Top (y): 0 Left (x): 256 Bottom: 255 Right: 511 Tile No.: x:1 y:1 Pixels: Top (y): 256 Left (x): 256 Bottom: 511 Right: 511
    22. Tiled Image Overlays: Tile Structure
        • Number of tiles per zoom level = 4**zoom
        • Number of pixels per zoom level = 4**(zoom + 8)
    23. Tiled Image Overlays: Tile Structure Demo Tile Detection Tool
    24. Tiled Image Overlays: Techniques
        • Tiles cut from images
        • Static data tiles
        • Dynamic data tiles
    25. Tiles cut from images
      • Basic concept: You already have the image (often scanned in), and you use a script to cut it into multi-resolution tiles
      • Uses:
        • Obsolete, historical, campus maps ( Sailing Map )
        • Fantastical maps ( MapWow )
        • Aerial photo imagery ( Mexico 1809 Map )
        • Panoramic photos ( Prague360 )
        • Other documents, books, magazines ( SPACE Mag )
      • Advantages:
        • Easily integrated, great user interface
      • Disadvantages:
        • Pixelation, Borders and text get bigger with zoom, image geolocation errors
    26. Tiles cut from images: Counties Example
        • County Tiles Cut from Source Image
          • Source image: 5462 x 2920, zoom 7
          • Zoom levels 5-9 generated with Perl script
          • Notice the aliasing that occurs when you zoom/pan
      Zoom 5 Zoom 6 Zoom 7 Zoom 8 Zoom 9
    27. Tiles cut from images: Conclusion Tiles cut from images are useful for many purposes, but suffer when extending to more than a few zoom levels due to pixelation, and they can be difficult to align with a base map.
    28. Static data tiles
      • Basic Concept: You have the data in some format, and you generate the tile layers just once from that data and store on your server.
      • Uses:
        • Displaying points of interest, heat maps, borders, other thematic data ( Zoning Map , Walkscore Heatmap)
      • Advantages:
        • Allows creation of nearly perfect tiles
        • Fast browser response regardless content
        • Great for polygons, markers and lines
      • Disadvantages:
        • Requires server side programming experience
        • Tiles generated on a schedule
    29. Static data tiles: Counties Example
      • Generated County Tiles
        • Tiles generated with Perl script using data in PostGRE database for zoom levels 5-9
        • Notice the constant edge thickness when you zoom/pan
      Zoom 5 Zoom 6 Zoom 7 Zoom 8 Zoom 9
    30. Static data tiles: Conclusion Static tiles created from data are extremely fast and efficient, can be made to work with any zoom level and any area. They don’t suffer from pixelation and are easily aligned to the map. Since they require building in advance, time sensitive and user driven requirements are difficult to address.
    31. Static Maps
    32. Static Maps API: Introduction
        • There are some drawbacks to using the JS API:
        • Download time for scripts + resources
        • Requires JavaScript and modern browser
      Solution: The Static Maps API 
        • How it works
        • Just add an <img> tag pointing to a well-crafted URL that specifies various parameters (center, zoom, size, etc)
        • Try it out in the   Google Static Map Wizard
        • When to use?
        • When the map isn’t the  main focus  of a page, and many users will not interact with it
        • If you cannot be sure the user has a  Javascript-enabled browser
        • On  mobile sites , where many users will not have a Javascript-enabled browser, and connections are slow
    33. Static Maps API: Examples
      • 1) Lonely Planet Mobile  
        • Displays static map of current user location
        • Plots nearby places to ‘sleep’, ‘play’, ‘eat’, ‘shop’ and ‘see’
        • Links to Lonely Planet review on each date
      • 2) Orbitz Mobile Update  
        • Generates static map of traffic incidents
        • Collects input from mobile users
      • 3) Glotter  
        • Displays thumbnails of maps
    34. Static Maps API: Tips and tricks
        • The Static Maps API can be combined with the Javascript API for a better user experience
        • 1. Start with a static map, loading JS API only if user interacts with it
        • e.g. Yelp  
        • 2. Load the full page, then append the Maps code (so map only loaded after rest of page)
        • e.g. iGoogle MapSearch Gadget  ,  Barry Hunter's Demo
    35. Flash API: Introduction
        • The Javascript API has limitations inherent to the platform
        • Painful to embed in Flash sites
        • Graphical/data streaming limitations
        • How does it work?
        • Lets you write code in Actionscript3, compile it against our interface library, and output a SWF containing an interactive Google Map
        • SWF can be embedded on your web page, Google Earth, MySpace, etc
        • The Flash API has all the main functionality of the Javascript API
      Solution: Flash Maps API
    36. Conclusion
      • Google Maps with APIs is Fun
      • Highly customizable from basic UI Elements to the tiles themselves
    SlideShare Zeitgeist 2009

    + rajdeeprajdeep Nominate

    custom

    1249 views, 0 favs, 0 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1249
      • 1249 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 0
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories