coma - CodenameOne Maps API

106 views
Skip to first unread message

Akintayo Abiona Olusegun

unread,
Nov 5, 2013, 8:44:56 AM11/5/13
to codenameone...@googlegroups.com
A google maps API for Codename One.

Most of the maps/maps related API can be called via url (rest based) and they returns JSON/XML.

Parsing the returned data can be an herculean task though. This is where coma excels.

coma parses the returned data and return to you java objects. For instance the below json

"bounds" : {
    "northeast" : {
        "lat" : 45.5101458,
        "lng" : -73.55252489999999
    },
    "southwest" : {
        "lat" : 43.6533103,
        "lng" : -79.38373319999999
    }
}

will return an object bounds that contains two objects northEast and southWest. Each of northEast and southWest will also contain a lat and lng double variables.

You can use the API like this -

Coma coma = new Coma();
Result result = Result.fromContent(is, Result.JSON);
Geocode geocode = new Geocode(coma);
GoogleGeocodeResult geocodeResult = geocode.parseGeoCodeResult(result);
List<SingleResult> results = geocodeResult.getResults();

Result result = Result.fromContent(is, Result.JSON);
Direction direction = new Direction(new Coma());
GoogleDirectionResult directionResult = direction.parseDirectionsResult(result);
List<SingleRoute> routes = directionResult.getRoutes();


The project is hosted on github - https://github.com/segun/coma

Hi Shai/Chen
If I compile this into a jar file, how do I use it in a CN1 project?

Thanks.

--
Akintayo A. Olusegun

Chief Executive Hustler
Idempotent Systems.

Skype: akintayo.segun
Gmail: akintayo.segun
Phone: 234-706-202-2486

-------------------------------------------------------------------------------------------------------
Akintayo Abiona Olusegun

pǝʇɐʇs ǝsıʍɹǝɥʇo ssǝlun unƃǝsnlo ɐuoıqɐ oʎɐʇuıʞɐ

Si crees que puedes, tienes razón. Si crees que no puedes tienes razón.

Chen Fishbein

unread,
Nov 5, 2013, 1:11:21 PM11/5/13
to codenameone...@googlegroups.com
well done!
build it to a CodenameOne library project and create a .cn1lib file from this.- http://www.codenameone.com/3/post/2013/07/jaring-and-libraries.html



wmary...@gmail.com

unread,
Jul 19, 2016, 4:43:34 AM7/19/16
to CodenameOne Discussions
hey akintayo can you give an example of putting your results in a form. i will appreciate
Reply all
Reply to author
Forward
0 new messages