×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Apr 2013
    Posts
    6

    Kml number limit of feature

    Hi,

    I use Nokia here api maps for javascript.


    I load kml feaures on the map it work perfectly but now i have a problem when i load a lot of features on the map.


    I can't load 2 kml files at the same time :if i load
    Code:
    kml.parseKML("http://localhost:50431" + "/commune/getCoordAllCommunesDep?IDDep=1");
    		            kml.parseKML("http://localhost:50431" + "/commune/getCoordAllCommunesDep?IDDep=2");
    		            kml.parseKML("http://localhost:50431" + "/commune/getCoordAllCommunesDep?IDDep=3");
    it only show the first result. If i retry, sometimes i see features from the second result.


    It's normal ? how could i can do this ?

  2. #2
    Regular Contributor
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    289

    Re: Kml number limit of feature

    If you want to load multiple concurrent KML files, the cleanest way to do would be to create multiple instances of nokia.maps.kml.Manager - The example below places each result set into a base container and sets the focus to the base container bounding box as it expands. An alternative would be to chain one KML file after another (i.e. alter the flow of the code each time onParsed is called) but this should only be necessary if the KML files you are loading are very big.

    This example relies on YOUR APP ID and TOKEN and two files called finland.kml and south-africa.kml on your server.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <!-- 
    	Example from Nokia Maps API Playground, for more information visit http://api.maps.nokia.com
    	or http://api.maps.nokia.com/en/playground/examples/maps/kml/kmlearthquake.html
     -->
    <html xmlns="http://www.w3.org/1999/xhtml">
    	<head>
    		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    		<meta http-equiv="X-UA-Compatible" content="IE=7; IE=EmulateIE9" />
    		<title>Nokia Maps API Example: </title>
    		<!-- KML support is required here. -->
    		<script type="text/javascript" charset="UTF-8" src="http://api.maps.nokia.com/2.2.4/jsl.js?kml=auto"></script>
    		
    		<script type="text/javascript">
    			var startTime=new Date();
    			function StopTime()
      		{
        		document.getElementById("endTime").innerHTML=String((new Date()-startTime)/1000);
      		}
    		</script>
    
    </head>
    		
    		
    		
    			<style type="text/css">
    			html {
    				overflow:hidden;
    			}
    			
    			body {
    				margin: 0;
    				padding: 0;
    				overflow: hidden;
    				width: 100%;
    				height: 100%;
    				position: absolute;
    			}
    			
    			#mapContainer {
    				width: 100%;
    				height: 90%;
    			}
    		</style>
    	</head>
    	<body>
    		<span id="endTime">0.0</span> 
    		<div id="mapContainer"></div>
    		<script type="text/javascript">
    /////////////////////////////////////////////////////////////////////////////////////
    // Don't forget to set your API credentials
    //
    // Replace with your appId and token which you can obtain when you 
    // register on http://api.developer.nokia.com/ 
    //
    			nokia.Settings.set( "appId", "APP_ID"); 
    			nokia.Settings.set( "authenticationToken", "TOKEN");
    //			
    /////////////////////////////////////////////////////////////////////////////////////	
    		</script>
    		<div id="uiContainer"></div>
    		<script>
    // Get the DOM node to which we will append the map
    var mapContainer = document.getElementById("mapContainer");
    
    // We create a new instance of InfoBubbles bound to a variable so we can call it later on
    var infoBubbles = new nokia.maps.map.component.InfoBubbles();
    infoBubbles.options.defaultWidth = 100;
    
    // Create a map inside the map container DOM node
    var map = new nokia.maps.map.Display(mapContainer, {
    	components: [
    		// We add the behavior component to allow panning / zooming of the map
    		new nokia.maps.map.component.Behavior(),
    		infoBubbles
    	]
    });
    
    var kml1 = new nokia.maps.kml.Manager();
    var kml2 = new nokia.maps.kml.Manager();
    
    var resultSet;
    var dataContainer = new nokia.maps.map.Container();
    map.objects.add(dataContainer);
    // We define a callback function for parsing kml file,
    // and then push the parsing result to map display
    var onParsed = function (kmlManager) {
    
    	
    	// KML file was successfully loaded
    	if (kmlManager.state == "finished") {
    		// KML file was successfully parsed
    		resultSet = new nokia.maps.kml.component.KMLResultSet(kmlManager.kmlDocument, map);
    		resultSet.addObserver("state", function (resultSet) {
    			if (resultSet.state == "finished") {
    				// Retrieve map objects container from KML resultSet
    				var resultsSetContainer = resultSet.container.objects.get(0);
    		
    				// Add the container to the map's object collection so they will be rendered onto the map.
    				dataContainer.objects.add(resultsSetContainer);
    				
    				// Switch the viewport of the map do show all KML map objects within the container
    				map.zoomTo(dataContainer.getBoundingBox());
    				map.addObserver("mapviewchangeend", StopTime() );
    			}
    		});
    		resultSet.create();
    	}
    };
    // Add an observer to kml manager
    kml1.addObserver("state", onParsed);
    kml2.addObserver("state", onParsed);
    
    // Start parsing a kml file with given url
    // Note: please adapt the following path to the file you want to parse.
    kml1.parseKML("finland.kml");
    kml2.parseKML("south-africa.kml");
    
     </script>
    	</body>
    </html>

Similar Threads

  1. Limit on the number of application downloads
    By beginner@nokia in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 1
    Last Post: 2011-01-25, 09:06
  2. Is there a limit to number of running threads?
    By katcapuli in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2008-08-27, 12:51
  3. CAknTextQueryDialog Number limit
    By sruthimp in forum Symbian User Interface
    Replies: 1
    Last Post: 2007-06-15, 12:45
  4. How to dial a number from a WAP page / Use number feature
    By frostyfone in forum Browsing and Mark-ups
    Replies: 2
    Last Post: 2002-06-18, 15:30

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×