×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Jul 2012
    Posts
    6

    How to search an address ?

    Hello,

    I try to use "nokia.maps.search.Address()" But is not working and i do not find any example about this interface.
    Could you help me ?

    my code is :

    HTML Code:
    var mapContainer = document.getElementById("mapContainer");
    
    var map = new nokia.maps.map.Display(mapContainer, {
    	// initial center and zoom level of the map
    	components: [	
    	new nokia.maps.search.Address({
                          country: 'France',
    	})
    	]
    });


    Thanks
    Last edited by vp.web; 2012-07-31 at 17:50.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,168

    Re: How to search an address ?

    What excatly would you want to do ? If you simply want to know location for an address, then You could also check teh geo coding part of the API.

  3. #3
    Registered User
    Join Date
    Jul 2012
    Posts
    6

    Re: How to search an address ?

    Hello symbianyucca,
    Thank you for your help.

    I saw that nokia.maps.search.Address() disappear on Nokia Maps API Reference 2.2.1 !

    I would like to find a point on the map not with Coordinates ([52.51, 13.4]) but with an address (10178 Berlin, Germany).
    I tried to find a solution on the geo coding part of the API, but i can't find an option with searching address !

    I understood that the code for searching a point with coordinates is :

    HTML Code:
    var map = new nokia.maps.map.Display(document.getElementById("mapContainer"), {
            // Zoom level for the map
            'zoomLevel': 10,
            // Map center coordinates
            'center': [52.51, 13.4] 
        });
    But how to do with an address (10178 Berlin, Germany) ?

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,168

    Re: How to search an address ?

    You could check the definition for Geo Coding: http://en.wikipedia.org/wiki/Geocoding ,its really for finding coordinates with address information..

    Wiki would have some stuff for it: http://www.developer.nokia.com/Commu...coding_service and do check the docs & playground.

  5. #5
    Registered User
    Join Date
    Jul 2012
    Posts
    6

    Re: How to search an address ?

    I found it with an other way !
    thanks for you time!

    Here my code

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <?php 		$map_height = "height: 340px";
    		$map_width = "width: 310px";
    		$adresse = '33210 MAZÈRES, France';
    		?>
        <head>
           <title>My first Nokia Maps web page</title>
           <link rel="stylesheet" type="text/css" href="http://api.maps.nokia.com/en/playground/exampleHelpers.css"/>
           <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
           <script type="text/javascript" src="http://api.maps.nokia.com/2.2.1/jsl.js?with=all" charset="utf-8"></script>
    				<script type="text/javascript" charset="UTF-8" src="http://api.maps.nokia.com/en/playground/exampleHelpers.js"></script>
        		<style type="text/css">
    			html {
    				overflow:hidden;
    			}
    			
    			body {
    				margin: 0;
    				padding: 0;
    				overflow: hidden;
    				width: 100%;
    				height: 100%;
    				position: absolute;
    			}
    			
    			#mapContainer {
    				width: 100%;
    				height: 100%;
    				left: 0;
    				top: 0;
    				position: absolute;
    			}
    		</style>
    </head>
        <body>
            <h1>My first Nokia Map!</h1>
            <!--<div id="mapContainer" style="width:310px; height:340px;"></div>-->
    
    				<div id="mapContainer"></div>
        
        
    <script type="text/javascript">
    /////////////////////////////////////////////////////////////////////////////////////
    // http://api.maps.nokia.com/en/index.html
    //
    			nokia.Settings.set( "appId", ""); 
    			nokia.Settings.set( "authenticationToken", "");	
    //			
    /////////////////////////////////////////////////////////////////////////////////////
    
    //nokia.Settings.set("defaultLanguage", "de-DE");
    nokia.Settings.set("defaultLanguage", "fr-FR");
    
    
    // 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();
    
    // Create a map inside the map container DOM node
    var map = new nokia.maps.map.Display(mapContainer, {
    	// initial center and zoom level of the map
    	center: [52.51, 13.4],
    	zoomLevel: 10,
    	components:[
    		// We add the behavior component to allow panning / zooming of the map
    		new nokia.maps.map.component.Behavior(),
    		infoBubbles
    	]
    });
    
    
    var addresses = [
    		"France", // Brandenburger Tor
    		"69005 lyon, france", // Fernsehturm 
    		"Friedrichstr. 44, 10969 Berlin" // Checkpoint Charlie
    	],
    	// We will put our address markers into this container zo we can zoom in to the markers
    	addressesContainer = new nokia.maps.map.Container(),
    	marker,
    	searchCenter = new nokia.maps.geo.Coordinate(52.51, 13.4),
    	searchManager = nokia.places.search.manager,
    	i = 0 , 
    	len = requests = addresses.length;
    	
    map.objects.add(addressesContainer);
    
    var processResults = function (data, requestStatus, requestId) {
    	// Data is instance of nokia.places.objects.Place 
    	var location = data.location;
    
    	// Ensure that we our request came back with valid result
    	if (requestStatus == "OK") {
    		// Create a new marker on the found location
    		marker = new nokia.maps.map.StandardMarker(location.position);
    		// Add marker to its container so it will be render
    		addressesContainer.objects.add(marker);
    		
    		/* We store the address from the location and name of the
    		 * Place object in the marker so we can create an infoBubble 
    		 * with this information on click.
    		 */
    		marker.$address = location.address;
    		marker.$label = data.name;
    	}
    };
    
    /* We use nokia.places.search.manager.geCode to translate
     * the given address to a nokia.places.objects.Place which
     * contains the longitude and latitude
     */
    for (; i < len; i++) {
    	searchManager.geoCode({
    		searchTerm: addresses[i],
    		onComplete: function (data, requestStatus, requestId) {
    			processResults(data, requestStatus, requestId);
    			requests--;
    			if (requests == 0) {
    				map.zoomTo(addressesContainer.getBoundingBox());
    			}
    		}
    	});
    }
    
    </script>
        </body>
    </html>
    

  6. #6
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,168

    Re: How to search an address ?

    Yep, same thing anyway, its using the searchManager.geoCode in the end.

  7. #7
    Registered User
    Join Date
    Jul 2012
    Posts
    6

    Re: How to search an address ?

    hello symbianyucca,

    thanks for the link with the method "nokia.places.search.manager.findPlaces()". It is a good idea, i will certainly use for future code.

    I have another question.
    In my last code when I search an address, the zoom is on the max (street)
    Il would like to change it. Do you have an idea ?

    HTML Code:
    var addresses = [
    		"Friedrichstr. 44, 10969 Berlin" //
    	],
    	// We will put our address markers into this container zo we can zoom in to the markers
    	addressesContainer = new nokia.maps.map.Container(),
    	marker,
    	searchCenter = new nokia.maps.geo.Coordinate(52.51, 13.4),
    	searchManager = nokia.places.search.manager,
    	i = 0 , 
    	len = requests = addresses.length;

  8. #8
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,168

    Re: How to search an address ?

    Basically the API does have function for changing the Zoom level, so not understanding on what the problem on utilizing it is ?

  9. #9
    Registered User
    Join Date
    Jul 2012
    Posts
    6

    Re: How to search an address ?

    sorry i was not clear.

    The "zoomlevel" on nokia.maps.map.Display is the initial zoom.
    But when I search automatically an address with my "var addresses" the zoom change, to be at the max (20).

    I want to zoom in to the marker (my address) but not too much... (for example : 5)
    Do you have an idea ?

    Here my page
    http://www.concourslyon.com/b_map_nokia3.php

  10. #10
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,168

    Re: How to search an address ?

    basically, there is no magic happening, you are calling map.zoomTo(addressesContainer.getBoundingBox()); to zoom the map. So if you have only one item, it will zoom to max. So you should change your logic to handle the situation differently.

  11. #11
    Registered User
    Join Date
    Jul 2012
    Posts
    6

    Re: How to search an address ?

    ok thank you i will work on it !

Similar Threads

  1. Search -> Repeat search -> Post new thread
    By krzysztof.kucharewicz in forum Feedback on Forum Nokia's Renewal 2010
    Replies: 3
    Last Post: 2011-01-21, 11:00
  2. Possible to do service search without device search?
    By ed_welch in forum Mobile Java Networking & Messaging & Security
    Replies: 8
    Last Post: 2008-02-11, 11:35
  3. Address book's Contact search functionality...
    By ashisht4u in forum Mobile Java General
    Replies: 2
    Last Post: 2006-06-11, 00:45
  4. Replies: 0
    Last Post: 2003-06-04, 19:11

Posting Permissions

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