J2MeMap Mashups!
J2memap is the first mobile program that allows you to create Mashup with services likes GoogleMap, Yahoo!Maps and others. Check what have been made already on J2memap blog, and in particular the Flick Search Mashup, as well as the WikiMapia one, or the fon one.... You we'll see others examples in this blog.
You can extends J2ME Map in two ways:
* By accessing to your own XML data file, and display it on your screen. That's the easiest way, and probably serve mose of the needs, especally since the support of the GPX file format
* By writing your own piece of code that use some J2ME Maps component.
Here I will explain you both methods...
Providing custom XML data:
Create your own XML data files to display some informations....
Several format are supported: GPX file format
The KML file format (partially), the one used with GoogleEarth..
And the internal XML format (see below)
Note: do not expect to load all GPX or KML files, especially because they are usually very verbose, and too big to fit in small devices. However, some reasonable file should fit ok in small device.
GPX Support
The following property are supported: waypoint, trackpoint but only one trackseg (the longest one will be displayed). As an example, this show you the result of a GPX file downloaded directly from GeoFindef (URL: 17-Mile Drive) and the display on a device(on the left)
XML format:
Several XML tags are supported, as there is no real standard here... For instance, location could be described with geo:lat or lat tags and even latitude. So this will require a full list , for now it's just a subset....- marker on a screen.
- title
- address
- specific icons
- phone numbers
- assiocated pictures
- path (for directions for instance)...
Look here for a sample of such script: testData.xml
Then, in your mobile, in the menu "Your own mobile data...." you cun put the URL of this XML file. Note that if you change the URL, it will be automatically saved...
XML syntax...
Name |
Description |
points |
An
encoded list of coordinates that represents a polyline. This is the
same encoding than the one used by GoogleMap. More detailled
description to come in |
items |
The first elements for the
coming list of items. All items must be enclosed by this |
item |
Start
the description of a single item |
title |
Item title, that is similiar to
"name". Will be used for name |
name |
Name
of the item. Will be displayed on screen |
description |
Description of an item.
Everything but not address. |
address |
The
address of the item. This field will be used for direction finding for
instance. |
geo:lat |
Latitude of this item. This will
tell J2memap where to display the item (address is here just for
information purpose). |
geo:lon |
Longitude
of this item. |
tel |
Phone Number, that could be used
in the detailled description of the item |
icon |
An
url that will reference a picture to be displayed as an icon. Use png
file if possible, to avoid compatibility issues |
photoURL |
the URL of a more detailled
picture, that will be displayed if the user want to have more
information on an item. Here also, avoid to have big images.... |
Note that due to memory limitation and constraints, the XML parsing might not be as error prone as it should be, but a well formatted XML file should work well....
Using directly the MapCanvas API:
Note: to use this, you must obtain a non obfuscated version of J2MEMap. Contact me for this: thomas.landspurg@gmail.com
The second method, is by acessing directly to the API.
The JavaDoc API is visible here: J2ME Map Java Doc API.
How to use it:
- create your application, and use the MapCanvas object. This is the core of the Map display... When displayed, the earth Canvas object can be moved with key, and be zoomed in and out.
- then, your application could add the extra stuff: adding marker (using the oneLoc object), fetching data from the web, etc...
- some utility functions and classes are provided to ease your task
Example:
import net.landspurg.map.*; |
.