SlideShare a Scribd company logo
Nokia Series 40

Application Development and
Design with the Nokia Maps API
for Java ME on Series 40 phones


Jason Fox
Technical Support Engineer
Maps Platform
1   © Nokia 2012 Advanced Maps on Apps.pptx
Agenda
1. Brief Overview of the Nokia Maps API
   for Java ME.
2. Where to store your Geographic data
3. Data Feeds (JSON + XML)
4. Parsing Data from a Web Service
5. KML
6. Overlays


2   © Nokia 2012 Advanced Maps on Apps.pptx
A Brief Overview of the Nokia
Maps API for Java ME



3   © Nokia 2012 Advanced Maps on Apps.pptx
What is Nokia Maps API for Java ME?
•       API aimed at Series 40 Phones. Allows you to
        develop mobile applications based on Nokia
        Maps.

•       Façade Pattern - hides all the “plumbing” code -
        the low level connection calls, image
        manipulation etc.

•       Targets devices supporting MIDP 2.0 or higher.

•       Not currently part of the SDK

•       Single downloadable JAR around 150 kB.

•       Faster App development. Better App performance

Full details at :
http://www.developer.nokia.com/Develop/Maps/Maps_API_for_Java_ME/

    4     © Nokia 2012 Advanced Maps on Apps.pptx
What Features does the API have?
• Interactive Maps on Series 40
  phones
     • Multiple map types
     • Multiple languages available

• Markers, Images, Polygons,
  Polylines, Pan and Zoom.

• Search, routing and POI information
  services.

• Open to extension

5   © Nokia 2012 Advanced Maps on Apps.pptx
What problems does the API
solve?
      or

        “Why your S40 Map App should use
        the Nokia Maps API for Java ME”




6   © Nokia 2012 Advanced Maps on Apps.pptx
What problems does the API solve? (1)
• Series 40 Phones
    • Small Screen Size
    • Typical phone does not have onboard maps.

• Nokia Maps are Mobile Optimised
    • Reduced clutter on screen
    • Large Fonts Readable on Small Display
    • Lower Colour Saturation
    • Pan and Zoom Pass control to the User to get Context on the
       Map
    • Map tiling and caching for low latency and reduced network
       traffic




7   © Nokia 2012 Advanced Maps on Apps.pptx
What problems does the API solve? (2)
Opportunities
• Introduce geographic context to your information.
• Displaying an interactive Map

You have :
• Geographical Information that you wish to show in context.

You want:
• A convenient front-end Presentation Layer for displaying your
  information.
     • MapDisplay to get the right Map on the screen
     • MapObjects to overlay this Map with your information
     • MapComponents to extend and interact with your
        information


8   © Nokia 2012 Advanced Maps on Apps.pptx
What problems does the API solve? (3)
Opportunities
• The ability to enhance your application through
  accessing additional API services
     • Search
     • Places
     • Routing


• Able to display complex data sets whilst
  reducing development time
    • Overlays
    • KML Support




9   © Nokia 2012 Advanced Maps on Apps.pptx
Storing, Obtaining and
Displaying Data for your
Map-based Application



10   © Nokia 2012 Advanced Maps on Apps.pptx
The Generic Use Case for a Map Based
Application
 A typical Map-based application will:
 • Obtain application data from somewhere (e.g. a Web service)
 • Display a map with associated Map Markers
 • When the user clicks on a map marker the app will a display more
    information associated with that location on a separate screen.




 Why use a map-based interface?
 • Familiar Paradigm
 • Intuitive
 • Easy to use


11   © Nokia 2012 Advanced Maps on Apps.pptx
What design does this indicate? (1)
In the generic use case:
• the data could come from anywhere
• the data could be in any format.

Hence none of this is wired up automatically. You have to plug it in
yourself.

But there is one constant across the data for every map based
application:

     “Every datum point will consist of both
     geographic and non geographic information”



12   © Nokia 2012 Advanced Maps on Apps.pptx
What design does this indicate? (2)
From the geographic information:
• Create a GeoCoordinate from the longitude/latitude associated with
   each datum point.
• Add a marker to the map to highlight the location of the GeoCoordinate
   using either a MapStandardMarker or a MapMarker




From the non-geographic information:
• Use a Hashtable to associate the MapMarker with the non-geographic
   information.




13   © Nokia 2012 Advanced Maps on Apps.pptx
What design does this indicate? (3)
Whenever interaction occurs, the app needs to :

• Check if a marker has been “clicked”

• Retrieve the associated non-geographic
  information from the Hashtable

• Do any necessary additional operations




14   © Nokia 2012 Advanced Maps on Apps.pptx
Where does the app get its data from?
Data can be conveniently split into two types:
         Static Data
         • Fixed, unchanging
         • Can be bundled with the App
         • No need for a data connection


                                               Dynamic Data
                                               • Volatile, unreliable
                                               • Keeps the App relevant
                                               • Needs to be requested from
                                                 a web service

Avoid the overhead of dynamic data wherever possible, but you will
need to go online anyway since the maps require a data connection

15   © Nokia 2012 Advanced Maps on Apps.pptx
How dynamic is your dynamic data?
Completely Static Data e.g. Quiz App - “Capitals of the World”
•        Bundle data with app

Long Period Data e.g. “Festival 2012”
•        Bundle data with app, update app version next year.

Short Period Data e.g. “Tourist Guide for …”
•        Read once then store and retrieve from device


Daily Data e.g. “Deals for Today …”
•        Read online summary once on start up.
•        May need to request more details later


Real Time Updates e.g. “Social Media”
•        Poll online for limited data summaries


    16     © Nokia 2012 Advanced Maps on Apps.pptx
Data Feeds and Formats




17   © Nokia 2012 Advanced Maps on Apps.pptx
Data Feeds
There are currently two popular alternative data formats for
transmitting structured data over a network connection. Both are
language independent and text based.

JSON http://json.org
• Syntax is derived from JavaScript
• Structure is defined through the use of brackets [{]}
• Objects are mapped as key-value pairs separated by a colon :

XML http://www.w3.org/TR/REC-xml
• Syntax is defined by the World Wide Web Consortium
• Structure consists of nesting elements with matching start and end tags.
• Objects are defined as the content between the tags and any attributes
  (key-value pairs) associated to the element.



18   © Nokia 2012 Advanced Maps on Apps.pptx
JSON Data Format




Data received will be a consistent format which may contain
• key-value pairs - “name”
• arrays of elements - “coordinates”
• complex types - “geo”

19   © Nokia 2012 Advanced Maps on Apps.pptx
XML Data Format




• Simple key-value pairs are held within a single pair of tags - <name>

• Complex elements may have attributes - <geo>

• Arrays may be build up from multiple elements with the same name.
  Conventionally array elements are given plural names - for example,
  the <results> element contains a series of <result> elements

20   © Nokia 2012 Advanced Maps on Apps.pptx
Parsing and Displaying Data
from a Web Service
       or

         “Getting your map data on screen
         the hard way”




21   © Nokia 2012 Advanced Maps on Apps.pptx
Parsing JSON Data
No standard JSON parser library available. Need to write your own.
Hint: An Example JSON parser can be found bundled with the API examples

• Parser will typically place all JSON objects into a Hashtable , need to
  extract the entries you require by either:

      •    casting directly (for simple types) e.g. key-value pairs

      •    building up more complex element step by step




Still have to know the data structure, names of entries and so on.
… and then create your MapMarkers, and data associations etc.



22   © Nokia 2012 Advanced Maps on Apps.pptx
Parsing XML Data
A Standard SAX parser implementation of JSR 172 comes as part of the
Java ME Web Services Optional package. It will fire events as the XML is
processed. Override these events to process your data.

      •    startElement() fired whenever the parser encounters an opening <tag>




      •    characters() occurs for all text within the <tag>…</tag>




      •      endElement() fired whenever the parser encounters a closing </tag>




Still have to know the data structure, element qnames, attributes and so
on … and finally create your MapMarkers, and data associations etc…

23   © Nokia 2012 Advanced Maps on Apps.pptx
An Ideal Data Format
Wouldn’t it be more convenient if there existed a data format that:

• Used a standard on-board parsing library like XML?

• Had a standardised data structure so that I wouldn’t need to modify my
  parsing code for each implementation?

• Created and styled MapObjects directly from the data feed?

• Automatically associated each MapObject with its
  non-geographic data?

• Worked just as well on the web as on the
  device?


                             This is KML
24   © Nokia 2012 Advanced Maps on Apps.pptx
What is KML?
KML http://www.opengeospatial.org/standards/kml/

Keyhole Markup Language (KML) is an standardized XML notation for
geographic applications.

KML is able to:
•        Specify icons and labels to identify locations.
•        Specify additional information (e.g. address, phone number) associated with a specific
         location.
•        Define other elements such as polygons and polylines and attach them to the map.
•        Define styles to specify feature appearance.
•        Write HTML descriptions of features, including hyperlinks and embedded images
•        Use folders for hierarchical grouping of features

Most importantly a KML Parser already exists within the Maps API for Java ME.
No need to write your own parser. No need to write custom code to display and
interact with your data.

    25     © Nokia 2012 Advanced Maps on Apps.pptx
KML Data Format




• Exactly the same structure as any XML document
      •    KML is a subset of XML

• The names of each element in the KML feed are strictly defined
      •    the longitude/latitude must be a value held in a <coordinates> tag.
      •    for a point of interest this is enclosed in a <Point> tag.
      •    Every item on the map is defined inside a <Placemark> tag.




26   © Nokia 2012 Advanced Maps on Apps.pptx
The Relationship between MapObjects
and KML Elements
Many MapObjects have a direct equivalent in KML

     Nokia Maps API                       KML                KML            KML
     for Java ME                          Feature            Geometry       Style
     MapStandard                          <Placemark>        <Point>
     Marker                                  (with
                                          <styleUrl>)
     MapMarker                            <Placemark>        <Point>        <IconStyle>

     MapPolyline                          <Placemark>        <LineString>   <LineStyle>

     MapPolygon                           <Placemark>        <Polygon>      <PolyStyle>

     MapContainer                         <Folder> or
                                                <Document>
For parsed elements such as <description>, <phoneNumber> and
<extendedData> where no direct equivalent object exists, the API will give
access to the parsed KML data in the Feature interface.

27    © Nokia 2012 Advanced Maps on Apps.pptx
Parsing and Displaying KML
Data
  or

         “Getting your map data on screen
         the easy way”




28   © Nokia 2012 Advanced Maps on Apps.pptx
Parsing and Displaying a KML File (1)
1)        Implement a KMLParserListener and a KMLFactoryListener, create a
          KMLManager and call parseKML()- This will create a KML Document




2)        Handle Success and Failure.
             If successful, convert the KML Document into a KMLResultSet by
             calling KMLFactory.createMLResultSet()passing in the received
             KML Document.




     29     © Nokia 2012 Advanced Maps on Apps.pptx
Parsing and Displaying a KML File (2)
3)   Handle Success and Failure.
             If successful, the KMLResultSet.getContainer() will hold a
             MapContainer which has all your map data as MapObjects. You can
             add it to the MapDisplay in the usual manner, and zoom as necessary




4) Add Interactive KMLMapComponent as necessary.
             The KMLResultSet.getKMLMapComponent()
             will highlight styled <Placemark> elements
             when they are at the center of the screen, the
             KMLMapComponent needs to be added to the
             MapDisplay to do this.




30   © Nokia 2012 Advanced Maps on Apps.pptx
Interacting with KML File Data
5)        To receive onFocusChanged()events and interact with the <Placemark>
          elements, you will need to implement a KMLEventListener


6)        Attach the KMLEventListener to the KMLMapComponent of your result set.
          This obtained from KMLResultSet.getKMLMapComponent()




7)        An onFocusChanged()event is fired whenever a <Placemark> is moved
          onto or away from the center of the MapDisplay.




If you want to interact with other <Placemark> elements, you will have to iterate
through KMLResultSet.getFeatures().

     31     © Nokia 2012 Advanced Maps on Apps.pptx
Displaying Complex Datasets
An Introduction to Overlays




32   © Nokia 2012 Advanced Maps on Apps.pptx
How Map Providers and Overlays Work
• For the base map providers, the globe is divided into
  individual map tiles. These are retrieved online from
  Nokia’s map tile service.
                                                                                            Base Map Tiles
      •      At minimum zoom, the world is contained in a single 128x128 pixel tile.
      •      At the next zoom level up, the world is 2 tiles wide and 2 tiles high. Then
             4x4, 8x8, 16x16 etc.                                                               +
      •      Each zoom level splits the tiles in two, doubling the number of tiles across
             the width and height
      •      Each Map is based on the Normalized Mercator projection.

                                                                                            Overlay Tiles
• Overlays work in the same fashion - using your own map
  tile server complex visual data can be displayed at                                           =
  different zoom levels.
      •      One tile at minimum zoom, then 2x2, 4x4 and so on.
      •      Must be based on the Normalized Mercator projection.
                                                                                                Result
      •      Use PNG tiles to support transparency, so underlying map can be seen
             beneath your data.

33   © Nokia 2012 Advanced Maps on Apps.pptx
Implementing a MapURLProvider (1)
1)        To create your own overlay provider, create a subclass of MapURLProvider




2)        Implement the necessary abstract methods.




3)        Then add the overlay to the MapDisplay


4)        Don’t forget Overlay attribution if necessary.


     34     © Nokia 2012 Advanced Maps on Apps.pptx
Implementing MapURLProvider (2)
Necessary Overrides

•    String getTileUrl()
       • Used to create the URL in order to download an overlay map tile.
       • Map tile service requests are typically of the format:
          http://map_tiler_url/x_tile/y_tile/zoom_level/format.png

•    boolean isTileSupported()
       • Decides whether to make an http request to download the tile.
       • The API will throw onMapUpdateError()if a tile cannot be downloaded.

Optional Overrides

•    Image decode(byte[] data)
        • May be used for image post processing (e.g. scaling up images)

•    String getMimeType()
        • Default is PNG - override if Map tile service is not returning PNG images.


35     © Nokia 2012 Advanced Maps on Apps.pptx
For More Information

 Download the latest Nokia SDK for Java
 http://developer.nokia.com

 Consult the Nokia Developer Library
 http://library.developer.nokia.com

 Nokia Maps API
 http://developer.nokia.com/Maps




36   © Nokia 2012 Advanced Maps on Apps.pptx

More Related Content

PPTX
Apex 42-new-features-1867076
PPTX
Oracle business analytics best practices
PPTX
BPM und SOA machen mobil - Ein Architekturüberblick
PDF
Informatica to ODI Migration – What, Why and How | Informatica to Oracle Dat...
PPTX
Responsive Web Design ~ Best Practices for Maximizing ROI
PPTX
SAP BO and Teradata best practices
PDF
Optimise Nokia Maps applications for Nokia Asha Touch phones
PDF
Event-driven map components for Series 40 apps
Apex 42-new-features-1867076
Oracle business analytics best practices
BPM und SOA machen mobil - Ein Architekturüberblick
Informatica to ODI Migration – What, Why and How | Informatica to Oracle Dat...
Responsive Web Design ~ Best Practices for Maximizing ROI
SAP BO and Teradata best practices
Optimise Nokia Maps applications for Nokia Asha Touch phones
Event-driven map components for Series 40 apps

Similar to Advanced Maps on Apps for Series 40 (20)

PDF
Intro to apps with maps for series 40
PDF
Mobile Maps On Labs
PDF
ANDROID MAPPING APPLICATION
PDF
HERE Maps for the Nokia X platform
PDF
LUMIA APP LABS: WINDOWS PHONE 8 FOR NOKIA DEVELOPERS
PPTX
Location and API Maps in Windows Phone 8
PDF
Building Mobile Cross-Platform Geospatial Apps, Nick Landry
PDF
Size does not matter (if your data is in a silo)
PDF
C0422019024
PDF
Hands on with the Google Maps Data API
PDF
Maps API on_mobile_dev_festbangkok
PDF
NCGIC The Geospatial Revolution
PPTX
Crawlable Spatial Data - #Geo4Web research topic #3
PDF
The User-participated Geospatial Web as Open Platform
PDF
Comparative Study of Diverse API Perspective of Spatial Data
PDF
GIS in the Rockies Geospatial Revolution
PDF
Large scale geospatial analysis on mobile application usage
PPTX
Mobile computing fct
PPTX
Mobile Manifest - Nokia Maps
PPT
Mobile Monday Silicon Valley 6/1/09 - LBS App Demos
Intro to apps with maps for series 40
Mobile Maps On Labs
ANDROID MAPPING APPLICATION
HERE Maps for the Nokia X platform
LUMIA APP LABS: WINDOWS PHONE 8 FOR NOKIA DEVELOPERS
Location and API Maps in Windows Phone 8
Building Mobile Cross-Platform Geospatial Apps, Nick Landry
Size does not matter (if your data is in a silo)
C0422019024
Hands on with the Google Maps Data API
Maps API on_mobile_dev_festbangkok
NCGIC The Geospatial Revolution
Crawlable Spatial Data - #Geo4Web research topic #3
The User-participated Geospatial Web as Open Platform
Comparative Study of Diverse API Perspective of Spatial Data
GIS in the Rockies Geospatial Revolution
Large scale geospatial analysis on mobile application usage
Mobile computing fct
Mobile Manifest - Nokia Maps
Mobile Monday Silicon Valley 6/1/09 - LBS App Demos
Ad

More from Microsoft Mobile Developer (20)

PDF
Intro to Nokia X software platform 2.0 and tools
PDF
Lumia App Labs: Lumia SensorCore SDK beta
PDF
Nokia Asha from idea to app - Imaging
PPTX
Healthcare apps for Nokia X and Nokia Asha
PDF
Push notifications on Nokia X
PDF
DIY Nokia Asha app usability studies
PDF
Lessons learned from Nokia X UI reviews
PDF
Location based services for Nokia X and Nokia Asha using Geo2tag
PDF
Nokia In-App Payment - UX considerations
PDF
Introduction to Nokia Asha SDK 1.2 (beta)
PDF
UX considerations when porting to Nokia X
PDF
Kids' games and educational app design
PDF
Nokia X: opportunities for developers
PDF
Lumia App Labs: Nokia Imaging SDK 1.1
PDF
Intro to Nokia X software platform and tools
PDF
Lumia App Labs: Lessons learned from 50 windows phone 8 design consultations
PDF
Windows Phone 8 speech: parliamo con la nostra app
PDF
La pubblicazione di un'applicazione sullo store
PDF
Il pattern mvvm come strutturare al meglio il vostro progetto
PDF
Lens app trasformare il telefono in una fotocamera
Intro to Nokia X software platform 2.0 and tools
Lumia App Labs: Lumia SensorCore SDK beta
Nokia Asha from idea to app - Imaging
Healthcare apps for Nokia X and Nokia Asha
Push notifications on Nokia X
DIY Nokia Asha app usability studies
Lessons learned from Nokia X UI reviews
Location based services for Nokia X and Nokia Asha using Geo2tag
Nokia In-App Payment - UX considerations
Introduction to Nokia Asha SDK 1.2 (beta)
UX considerations when porting to Nokia X
Kids' games and educational app design
Nokia X: opportunities for developers
Lumia App Labs: Nokia Imaging SDK 1.1
Intro to Nokia X software platform and tools
Lumia App Labs: Lessons learned from 50 windows phone 8 design consultations
Windows Phone 8 speech: parliamo con la nostra app
La pubblicazione di un'applicazione sullo store
Il pattern mvvm come strutturare al meglio il vostro progetto
Lens app trasformare il telefono in una fotocamera
Ad

Recently uploaded (20)

PDF
Machine learning based COVID-19 study performance prediction
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Cloud computing and distributed systems.
PPTX
Big Data Technologies - Introduction.pptx
PPTX
A Presentation on Artificial Intelligence
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
cuic standard and advanced reporting.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Spectroscopy.pptx food analysis technology
PDF
Encapsulation theory and applications.pdf
PPT
Teaching material agriculture food technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
Machine learning based COVID-19 study performance prediction
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Cloud computing and distributed systems.
Big Data Technologies - Introduction.pptx
A Presentation on Artificial Intelligence
Advanced methodologies resolving dimensionality complications for autism neur...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
cuic standard and advanced reporting.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Spectroscopy.pptx food analysis technology
Encapsulation theory and applications.pdf
Teaching material agriculture food technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
20250228 LYD VKU AI Blended-Learning.pptx

Advanced Maps on Apps for Series 40

  • 1. Nokia Series 40 Application Development and Design with the Nokia Maps API for Java ME on Series 40 phones Jason Fox Technical Support Engineer Maps Platform 1 © Nokia 2012 Advanced Maps on Apps.pptx
  • 2. Agenda 1. Brief Overview of the Nokia Maps API for Java ME. 2. Where to store your Geographic data 3. Data Feeds (JSON + XML) 4. Parsing Data from a Web Service 5. KML 6. Overlays 2 © Nokia 2012 Advanced Maps on Apps.pptx
  • 3. A Brief Overview of the Nokia Maps API for Java ME 3 © Nokia 2012 Advanced Maps on Apps.pptx
  • 4. What is Nokia Maps API for Java ME? • API aimed at Series 40 Phones. Allows you to develop mobile applications based on Nokia Maps. • Façade Pattern - hides all the “plumbing” code - the low level connection calls, image manipulation etc. • Targets devices supporting MIDP 2.0 or higher. • Not currently part of the SDK • Single downloadable JAR around 150 kB. • Faster App development. Better App performance Full details at : http://www.developer.nokia.com/Develop/Maps/Maps_API_for_Java_ME/ 4 © Nokia 2012 Advanced Maps on Apps.pptx
  • 5. What Features does the API have? • Interactive Maps on Series 40 phones • Multiple map types • Multiple languages available • Markers, Images, Polygons, Polylines, Pan and Zoom. • Search, routing and POI information services. • Open to extension 5 © Nokia 2012 Advanced Maps on Apps.pptx
  • 6. What problems does the API solve? or “Why your S40 Map App should use the Nokia Maps API for Java ME” 6 © Nokia 2012 Advanced Maps on Apps.pptx
  • 7. What problems does the API solve? (1) • Series 40 Phones • Small Screen Size • Typical phone does not have onboard maps. • Nokia Maps are Mobile Optimised • Reduced clutter on screen • Large Fonts Readable on Small Display • Lower Colour Saturation • Pan and Zoom Pass control to the User to get Context on the Map • Map tiling and caching for low latency and reduced network traffic 7 © Nokia 2012 Advanced Maps on Apps.pptx
  • 8. What problems does the API solve? (2) Opportunities • Introduce geographic context to your information. • Displaying an interactive Map You have : • Geographical Information that you wish to show in context. You want: • A convenient front-end Presentation Layer for displaying your information. • MapDisplay to get the right Map on the screen • MapObjects to overlay this Map with your information • MapComponents to extend and interact with your information 8 © Nokia 2012 Advanced Maps on Apps.pptx
  • 9. What problems does the API solve? (3) Opportunities • The ability to enhance your application through accessing additional API services • Search • Places • Routing • Able to display complex data sets whilst reducing development time • Overlays • KML Support 9 © Nokia 2012 Advanced Maps on Apps.pptx
  • 10. Storing, Obtaining and Displaying Data for your Map-based Application 10 © Nokia 2012 Advanced Maps on Apps.pptx
  • 11. The Generic Use Case for a Map Based Application A typical Map-based application will: • Obtain application data from somewhere (e.g. a Web service) • Display a map with associated Map Markers • When the user clicks on a map marker the app will a display more information associated with that location on a separate screen. Why use a map-based interface? • Familiar Paradigm • Intuitive • Easy to use 11 © Nokia 2012 Advanced Maps on Apps.pptx
  • 12. What design does this indicate? (1) In the generic use case: • the data could come from anywhere • the data could be in any format. Hence none of this is wired up automatically. You have to plug it in yourself. But there is one constant across the data for every map based application: “Every datum point will consist of both geographic and non geographic information” 12 © Nokia 2012 Advanced Maps on Apps.pptx
  • 13. What design does this indicate? (2) From the geographic information: • Create a GeoCoordinate from the longitude/latitude associated with each datum point. • Add a marker to the map to highlight the location of the GeoCoordinate using either a MapStandardMarker or a MapMarker From the non-geographic information: • Use a Hashtable to associate the MapMarker with the non-geographic information. 13 © Nokia 2012 Advanced Maps on Apps.pptx
  • 14. What design does this indicate? (3) Whenever interaction occurs, the app needs to : • Check if a marker has been “clicked” • Retrieve the associated non-geographic information from the Hashtable • Do any necessary additional operations 14 © Nokia 2012 Advanced Maps on Apps.pptx
  • 15. Where does the app get its data from? Data can be conveniently split into two types: Static Data • Fixed, unchanging • Can be bundled with the App • No need for a data connection Dynamic Data • Volatile, unreliable • Keeps the App relevant • Needs to be requested from a web service Avoid the overhead of dynamic data wherever possible, but you will need to go online anyway since the maps require a data connection 15 © Nokia 2012 Advanced Maps on Apps.pptx
  • 16. How dynamic is your dynamic data? Completely Static Data e.g. Quiz App - “Capitals of the World” • Bundle data with app Long Period Data e.g. “Festival 2012” • Bundle data with app, update app version next year. Short Period Data e.g. “Tourist Guide for …” • Read once then store and retrieve from device Daily Data e.g. “Deals for Today …” • Read online summary once on start up. • May need to request more details later Real Time Updates e.g. “Social Media” • Poll online for limited data summaries 16 © Nokia 2012 Advanced Maps on Apps.pptx
  • 17. Data Feeds and Formats 17 © Nokia 2012 Advanced Maps on Apps.pptx
  • 18. Data Feeds There are currently two popular alternative data formats for transmitting structured data over a network connection. Both are language independent and text based. JSON http://json.org • Syntax is derived from JavaScript • Structure is defined through the use of brackets [{]} • Objects are mapped as key-value pairs separated by a colon : XML http://www.w3.org/TR/REC-xml • Syntax is defined by the World Wide Web Consortium • Structure consists of nesting elements with matching start and end tags. • Objects are defined as the content between the tags and any attributes (key-value pairs) associated to the element. 18 © Nokia 2012 Advanced Maps on Apps.pptx
  • 19. JSON Data Format Data received will be a consistent format which may contain • key-value pairs - “name” • arrays of elements - “coordinates” • complex types - “geo” 19 © Nokia 2012 Advanced Maps on Apps.pptx
  • 20. XML Data Format • Simple key-value pairs are held within a single pair of tags - <name> • Complex elements may have attributes - <geo> • Arrays may be build up from multiple elements with the same name. Conventionally array elements are given plural names - for example, the <results> element contains a series of <result> elements 20 © Nokia 2012 Advanced Maps on Apps.pptx
  • 21. Parsing and Displaying Data from a Web Service or “Getting your map data on screen the hard way” 21 © Nokia 2012 Advanced Maps on Apps.pptx
  • 22. Parsing JSON Data No standard JSON parser library available. Need to write your own. Hint: An Example JSON parser can be found bundled with the API examples • Parser will typically place all JSON objects into a Hashtable , need to extract the entries you require by either: • casting directly (for simple types) e.g. key-value pairs • building up more complex element step by step Still have to know the data structure, names of entries and so on. … and then create your MapMarkers, and data associations etc. 22 © Nokia 2012 Advanced Maps on Apps.pptx
  • 23. Parsing XML Data A Standard SAX parser implementation of JSR 172 comes as part of the Java ME Web Services Optional package. It will fire events as the XML is processed. Override these events to process your data. • startElement() fired whenever the parser encounters an opening <tag> • characters() occurs for all text within the <tag>…</tag> • endElement() fired whenever the parser encounters a closing </tag> Still have to know the data structure, element qnames, attributes and so on … and finally create your MapMarkers, and data associations etc… 23 © Nokia 2012 Advanced Maps on Apps.pptx
  • 24. An Ideal Data Format Wouldn’t it be more convenient if there existed a data format that: • Used a standard on-board parsing library like XML? • Had a standardised data structure so that I wouldn’t need to modify my parsing code for each implementation? • Created and styled MapObjects directly from the data feed? • Automatically associated each MapObject with its non-geographic data? • Worked just as well on the web as on the device? This is KML 24 © Nokia 2012 Advanced Maps on Apps.pptx
  • 25. What is KML? KML http://www.opengeospatial.org/standards/kml/ Keyhole Markup Language (KML) is an standardized XML notation for geographic applications. KML is able to: • Specify icons and labels to identify locations. • Specify additional information (e.g. address, phone number) associated with a specific location. • Define other elements such as polygons and polylines and attach them to the map. • Define styles to specify feature appearance. • Write HTML descriptions of features, including hyperlinks and embedded images • Use folders for hierarchical grouping of features Most importantly a KML Parser already exists within the Maps API for Java ME. No need to write your own parser. No need to write custom code to display and interact with your data. 25 © Nokia 2012 Advanced Maps on Apps.pptx
  • 26. KML Data Format • Exactly the same structure as any XML document • KML is a subset of XML • The names of each element in the KML feed are strictly defined • the longitude/latitude must be a value held in a <coordinates> tag. • for a point of interest this is enclosed in a <Point> tag. • Every item on the map is defined inside a <Placemark> tag. 26 © Nokia 2012 Advanced Maps on Apps.pptx
  • 27. The Relationship between MapObjects and KML Elements Many MapObjects have a direct equivalent in KML Nokia Maps API KML KML KML for Java ME Feature Geometry Style MapStandard <Placemark> <Point> Marker (with <styleUrl>) MapMarker <Placemark> <Point> <IconStyle> MapPolyline <Placemark> <LineString> <LineStyle> MapPolygon <Placemark> <Polygon> <PolyStyle> MapContainer <Folder> or <Document> For parsed elements such as <description>, <phoneNumber> and <extendedData> where no direct equivalent object exists, the API will give access to the parsed KML data in the Feature interface. 27 © Nokia 2012 Advanced Maps on Apps.pptx
  • 28. Parsing and Displaying KML Data or “Getting your map data on screen the easy way” 28 © Nokia 2012 Advanced Maps on Apps.pptx
  • 29. Parsing and Displaying a KML File (1) 1) Implement a KMLParserListener and a KMLFactoryListener, create a KMLManager and call parseKML()- This will create a KML Document 2) Handle Success and Failure. If successful, convert the KML Document into a KMLResultSet by calling KMLFactory.createMLResultSet()passing in the received KML Document. 29 © Nokia 2012 Advanced Maps on Apps.pptx
  • 30. Parsing and Displaying a KML File (2) 3) Handle Success and Failure. If successful, the KMLResultSet.getContainer() will hold a MapContainer which has all your map data as MapObjects. You can add it to the MapDisplay in the usual manner, and zoom as necessary 4) Add Interactive KMLMapComponent as necessary. The KMLResultSet.getKMLMapComponent() will highlight styled <Placemark> elements when they are at the center of the screen, the KMLMapComponent needs to be added to the MapDisplay to do this. 30 © Nokia 2012 Advanced Maps on Apps.pptx
  • 31. Interacting with KML File Data 5) To receive onFocusChanged()events and interact with the <Placemark> elements, you will need to implement a KMLEventListener 6) Attach the KMLEventListener to the KMLMapComponent of your result set. This obtained from KMLResultSet.getKMLMapComponent() 7) An onFocusChanged()event is fired whenever a <Placemark> is moved onto or away from the center of the MapDisplay. If you want to interact with other <Placemark> elements, you will have to iterate through KMLResultSet.getFeatures(). 31 © Nokia 2012 Advanced Maps on Apps.pptx
  • 32. Displaying Complex Datasets An Introduction to Overlays 32 © Nokia 2012 Advanced Maps on Apps.pptx
  • 33. How Map Providers and Overlays Work • For the base map providers, the globe is divided into individual map tiles. These are retrieved online from Nokia’s map tile service. Base Map Tiles • At minimum zoom, the world is contained in a single 128x128 pixel tile. • At the next zoom level up, the world is 2 tiles wide and 2 tiles high. Then 4x4, 8x8, 16x16 etc. + • Each zoom level splits the tiles in two, doubling the number of tiles across the width and height • Each Map is based on the Normalized Mercator projection. Overlay Tiles • Overlays work in the same fashion - using your own map tile server complex visual data can be displayed at = different zoom levels. • One tile at minimum zoom, then 2x2, 4x4 and so on. • Must be based on the Normalized Mercator projection. Result • Use PNG tiles to support transparency, so underlying map can be seen beneath your data. 33 © Nokia 2012 Advanced Maps on Apps.pptx
  • 34. Implementing a MapURLProvider (1) 1) To create your own overlay provider, create a subclass of MapURLProvider 2) Implement the necessary abstract methods. 3) Then add the overlay to the MapDisplay 4) Don’t forget Overlay attribution if necessary. 34 © Nokia 2012 Advanced Maps on Apps.pptx
  • 35. Implementing MapURLProvider (2) Necessary Overrides • String getTileUrl() • Used to create the URL in order to download an overlay map tile. • Map tile service requests are typically of the format: http://map_tiler_url/x_tile/y_tile/zoom_level/format.png • boolean isTileSupported() • Decides whether to make an http request to download the tile. • The API will throw onMapUpdateError()if a tile cannot be downloaded. Optional Overrides • Image decode(byte[] data) • May be used for image post processing (e.g. scaling up images) • String getMimeType() • Default is PNG - override if Map tile service is not returning PNG images. 35 © Nokia 2012 Advanced Maps on Apps.pptx
  • 36. For More Information Download the latest Nokia SDK for Java http://developer.nokia.com Consult the Nokia Developer Library http://library.developer.nokia.com Nokia Maps API http://developer.nokia.com/Maps 36 © Nokia 2012 Advanced Maps on Apps.pptx

Editor's Notes

  • #3: Which data feed to use?
  • #5: http://www.developer.nokia.com/info/sw.nokia.com/id/6bdf62e2-c739-4c29-bd9f-ddf8455f563e/JavaME.htmlFaçade Pattern - hides all the “plumbing” code - the low level connection calls, image manipulation etc. leaving a simple and consistent interface so you don’t need to reinvent the wheel.
  • #6: Does all the hard bits so you don’t have to bother.
  • #8: Typical Screen Size 320 x 240 pixels, 2.6 inchesAppropriate Map
  • #9: Scale Bar, tool tip animator
  • #12: Typcial Multi-tier architecture.MIDP – Good user experience but ….. …..Network connection setup is slow.Data rates are slow.The processor is slow.Memory is scarce.Because of these constraints, MIDP client applications should be designed to be as small as possible. Do as much as possible server side.
  • #13: The “What” and the “Where”
  • #14: The associoation is probably better implemented as a Map Component.
  • #15: Note that the SAMEDATA can be easily displayed in a multitude of ways.UX design course stated that.GIVE THEM THE OPTION
  • #16: Static dataHow dynamic is your dynamic data?For an application to remain relevant you need to be able t1) On device:2)How dynamic is your dynamic data?Since maps are not offline will require a web connection anyway
  • #17: in-app purchasing
  • #19: JSON used with WEBsites e.g. JavaScript will typically consume JSON feeds – use for cross platform.XML
  • #20: 40.0191219,-105.2746654 - Where does this place me? I’m apparently on 16th Street in Boulder, Colorado, USAArbitrary names for elements.
  • #22: The title of this slide is slightly misleading as the Display bit has already been covered previously (mainly basic maps webinar)Why do hard first - The discussion for the next couple of slides serves to show the purpose fulfilled by an on-board KML parser.
  • #23: Parser will read ALL the data first and then start processing.DEVELOPER will need to know data structure Will vary app to app.e.g. that a geo contains a coordinates which is an array.Also Need to know the keys of all the items – re-implement for each app.
  • #24: SAX not DOM – reduces memory overhead, but can’t jump around the fileNeed to read the whole tag – tag before processing. Could use this to deserialize data
  • #25: Benefits of KML – everything XML has plus well defined Geo-based structure. In common use. E.g. Earth Viewers.See benefits of Mobile Optimized on screen –compare web and mobile screens – mobile less cluttered and clearer.Ensure Icons are a minimal size 9x9 pixels.Tooltip here is non-standard – give minimal info prior to details. Avoid key press. Man City – nokia blue will be default.
  • #27: Same as the XML Example –just that the tag names have changed. Well defined NAMESPACE We are still in Boulder Colorado lat/long alt
  • #28: Use features to associate non-geographic data. Extended Data is a Map ObjectUse Geometries to define the Where on the screenUse Styles to alter the look-and- feel (StyleMap can do highlighting). Styles are MORE EFFICIENT when loading data than Inline Styles,.
  • #30: parseKML also handles URL connection.Document, Feature,PlaceMark– every class within the kml package have same name as associated KML element (Means there are two POINT classes.)parser.parse(getClass().getResourceAsStream(&quot;/premiership.kml&quot;), this);  obtain data from bundled resource.createResultSet can also Scale (if necessary) – if you have control do this server side, avoid overhead.
  • #31: The MapContainer from the ResultSet separates the View of the data on the MapDisplay from the underlining Data ModelAfter 3) you will get markers on the map. They won’t do anything though When d
  • #32: Why bother? – could use alternate maps – e.g. small text “Standard Web” versions.Easter Egg maps – e.g. Low Glare “Night Mode”. Recommendation – have a fallback.
  • #34: e.g. Weather, traffic sales data.
  • #36: MapTiler.org has a useful tool which explains various url addressing systems.Niothing wrong with providing small tiles and expanding them to fit Keep data overhead a munimumConsider adding a MApComponent which overrides paint to display small tileo