Map API

Nutiteq Maps Lib SDK enables developing advanced mobile mapping applications.
Platforms: Android, RIM BlackBerry, Java ME (J2ME)
Download maps API SDK »
Untitled Document

Products

» View demos
» Downloads

Latest news

Last at Tue, 6 Dec 2011 18:37:53
Topic: New BlackBerry sample app
See more news »

Adding KML to map, using Google MyMaps

No replies
jaak
User offline. Last seen 1 day 10 hours ago. Offline
Joined: 06/19/2008

How to add KML MyMap, it works with both MapComponent and MapItem.

See also http://www.nutiteq.com/google_mymaps_mobile.html

1. Create My Map, right-click "View in Google Earth", select "Copy Link Location" (in case of FireFox). You get URL for Google Earth.

2. Problem with this link is is that its output is network link (you see output=nl in URL). Change it to kml (output=kml in URL), as Lib does not support network link type of KML yet.

3. Add it to map with following code, with one developer's map example:

KmlUrlReader myKmlUrlReader = new KmlUrlReader(
"http://maps.google.co.in/maps/ms?hl=en&client=firefox-a&ei=HtcLSruhM9iBkQWpy6imBA&ie=UTF8&lci=com.panoramio.all&msa=0&output=kml&msid=110252955625368364595.000469dba90549c3643cb&",false);
mapComponent.addKmlService(myKmlUrlReader);

Note also following:
1. Be sure to add & or ? to the end of URL, as library appends own parameters (BBOX etc) to it automatically (without adding & or ?), so without this URL becomes invalid
2. If KMLUrlReader's needsUpdateAfterRead parameter is set to false, then after first reading of map it is not reloaded. If it is "true", then KML is reloaded with new BBOX always if map is zoomed, or moved more than certain amount. This is very useful to reduce amount of current objects if you have a lot (more than ~100) objects to show.
3. Library always appends BBOX parameters (independent from needsUpdateAfterRead parameter), so if initial map view is outside of KML coverage, and server interprets BBOX values, then you may get no data. However, Google MyMaps server does not use this currently, so you can safely use "false" here, like given in example above.

Google MyMaps sample screenshotGoogle MyMaps sample screenshot

/JaakL