IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

APIs Google Discussion :

Stocker les adresses dans une base mysql [Google Maps]


Sujet :

APIs Google

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre très actif
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Décembre 2010
    Messages
    118
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Autre

    Informations professionnelles :
    Activité : Chercheur en informatique
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Décembre 2010
    Messages : 118
    Par défaut Stocker les adresses dans une base mysql
    Bonjour

    mon objectif c'est d'arrivée a récupérer les adresses des lieux tracé entre deux point sur google maps, j'ai un zone de texte point départ et un autre zone de texte point arrivé le chemin entre ces deux point affiche plusieurs adresses je veux les récupérés dans un tableau mysql.

    voici mon code api maps v3:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
     var rendererOptions = {
      draggable: true
    };
     
    (function(mapDemo, $, undefined) {
    	mapDemo.Directions = (function() {
    		function _Directions() {
    			var map,   
    				directionsService, directionsDisplay, 
    				autoSrc, autoDest, pinA, pinB, 
     
    				markerA = new google.maps.MarkerImage('m1.png',
    						new google.maps.Size(24, 27),
    						new google.maps.Point(0, 0),
    						new google.maps.Point(12, 27)),		
    				markerB = new google.maps.MarkerImage('m2.png',
    						new google.maps.Size(24, 28),
    						new google.maps.Point(0, 0),
    						new google.maps.Point(12, 28)), 
     
    				// Caching the Selectors		
    				$Selectors = {
    					mapCanvas: jQuery('#mapCanvas')[0], 
    					dirPanel: jQuery('#directionsPanel'),
    					dirInputs: jQuery('.directionInputs'),
    					dirSrc: jQuery('#dirSource'),
    					dirDst: jQuery('#dirDestination'),
    					getDirBtn: jQuery('#getDirections'),
    					dirSteps: jQuery('#directionSteps'), 
    					paneToggle: jQuery('#paneToggle'), 
    					useGPSBtn: jQuery('#useGPS'), 
    					paneResetBtn: jQuery('#paneReset')
    				},
     
    				autoCompleteSetup = function() {
    					autoSrc = new google.maps.places.Autocomplete($Selectors.dirSrc[0]);
    					autoDest = new google.maps.places.Autocomplete($Selectors.dirDst[0]);
    				}, // autoCompleteSetup Ends
     
    				directionsSetup = function() {
    					directionsService = new google.maps.DirectionsService();
    					directionsDisplay = new google.maps.DirectionsRenderer(rendererOptions);	
    					//directionsDisplay = new google.maps.DirectionsRenderer({
    					//	suppressMarkers: true
    					//});	
     
    					directionsDisplay.setPanel($Selectors.dirSteps[0]);											
    				}, // direstionsSetup Ends
     
    				trafficSetup = function() {					
    					// Creating a Custom Control and appending it to the map
    					var controlDiv = document.createElement('div'), 
    						controlUI = document.createElement('div'), 
    						trafficLayer = new google.maps.TrafficLayer();
     
    					jQuery(controlDiv).addClass('gmap-control-container').addClass('gmnoprint');
    					jQuery(controlUI).text('Traffic').addClass('gmap-control');
    					jQuery(controlDiv).append(controlUI);				
     
    					// Traffic Btn Click Event	  
    					google.maps.event.addDomListener(controlUI, 'click', function() {
    						if (typeof trafficLayer.getMap() == 'undefined' || trafficLayer.getMap() === null) {
    							jQuery(controlUI).addClass('gmap-control-active');
    							trafficLayer.setMap(map);
    						} else {
    							trafficLayer.setMap(null);
    							jQuery(controlUI).removeClass('gmap-control-active');
    						}
    					});							  
    					map.controls[google.maps.ControlPosition.TOP_RIGHT].push(controlDiv);								
    				}, // trafficSetup Ends
     
    				mapSetup = function() {					
    					map = new google.maps.Map($Selectors.mapCanvas, {
    							zoom: 11,
    							center: new google.maps.LatLng(34.20, -6.60),	
     
    		                    mapTypeControl: true,
    		                    mapTypeControlOptions: {
    		                        style: google.maps.MapTypeControlStyle.DEFAULT,
    		                        position: google.maps.ControlPosition.TOP_RIGHT
    		                    },
     
    		                    panControl: true,
    		                    panControlOptions: {
    		                        position: google.maps.ControlPosition.RIGHT_TOP
    		                    },
     
    		                    zoomControl: true,
    		                    zoomControlOptions: {
    		                        style: google.maps.ZoomControlStyle.LARGE,
    		                        position: google.maps.ControlPosition.RIGHT_TOP
    		                    },
     
    		                    scaleControl: true,
    							streetViewControl: true, 
    							overviewMapControl: true,
     
    							mapTypeId: google.maps.MapTypeId.ROADMAP
    					});
     
    					autoCompleteSetup();
    					directionsSetup();
    					trafficSetup();
    				}, // mapSetup Ends 
     
    				directionsRender = function(source, destination) {
    					$Selectors.dirSteps.find('.msg').hide();
    					directionsDisplay.setMap(map);
     
    					var request = {
    						origin: source,
    						destination: destination,
    						provideRouteAlternatives: false, 
    						travelMode: google.maps.DirectionsTravelMode.DRIVING
    					};		
     
    					directionsService.route(request, function(response, status) {
    						if (status == google.maps.DirectionsStatus.OK) {
     
    							directionsDisplay.setDirections(response);
     
    							var _route = response.routes[0].legs[0]; 
     
    							pinA = new google.maps.Marker({position: _route.start_location, map: map, icon: markerA}), 
    							pinB = new google.maps.Marker({position: _route.end_location, map: map, icon: markerB});																	
    						}
    					});
    				}, // directionsRender Ends
     
    				fetchAddress = function(p) {
    					var Position = new google.maps.LatLng(p.coords.latitude, p.coords.longitude),  
    						Locater = new google.maps.Geocoder();
     
    					Locater.geocode({'latLng': Position}, function (results, status) {
    						if (status == google.maps.GeocoderStatus.OK) {
    							var _r = results[0];
    							$Selectors.dirSrc.val(_r.formatted_address);
    						}
    					});
    				}, // fetchAddress Ends
     
    				invokeEvents = function() {
    					// Get Directions
    					$Selectors.getDirBtn.on('click', function(e) {
    						e.preventDefault();
    						var src = $Selectors.dirSrc.val(), 
    							dst = $Selectors.dirDst.val();
     
    						directionsRender(src, dst);
    					});
     
    					// Reset Btn
    					$Selectors.paneResetBtn.on('click', function(e) {
    						$Selectors.dirSteps.html('');
    						$Selectors.dirSrc.val('');
    						$Selectors.dirDst.val('');
     
    						if(pinA) pinA.setMap(null);
    						if(pinB) pinB.setMap(null);		
     
    						directionsDisplay.setMap(null);					
    					});
     
    					// Toggle Btn
    					$Selectors.paneToggle.toggle(function(e) {
    						$Selectors.dirPanel.animate({'left': '-=305px'});
    						jQuery(this).html('>');
    					}, function() {
    						$Selectors.dirPanel.animate({'left': '+=305px'});
    						jQuery(this).html('<');
    					});
     
    					// Use My Location / Geo Location Btn
    					$Selectors.useGPSBtn.on('click', function(e) {		
    						if (navigator.geolocation) {
    							navigator.geolocation.getCurrentPosition(function(position) {
    								fetchAddress(position);
    							});	
    						}
    					});
    				}, //invokeEvents Ends 
     
    				_init = function() {
    					mapSetup();
    					invokeEvents();
    				}; // _init Ends
     
    			this.init = function() {
    				_init();
    				return this; // Refers to: mapDemo.Directions
    			}
    			return this.init(); // Refers to: mapDemo.Directions.init()
    		} // _Directions Ends
    		return new _Directions(); // Creating a new object of _Directions rather than a funtion
    	}()); // mapDemo.Directions Ends
    })(window.mapDemo = window.mapDemo || {}, jQuery);
    Merci!

  2. #2
    Membre très actif
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Décembre 2010
    Messages
    118
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Autre

    Informations professionnelles :
    Activité : Chercheur en informatique
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Décembre 2010
    Messages : 118
    Par défaut ici la solution
    Bonjour

    j'ai trouver la solution à mon problème ici

    C'est très utiles pour le sauvegarde des trajets Waypoint de google maps api 3

    Enjoy!

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 2
    Dernier message: 17/11/2009, 16h27
  2. stocker un pdf dans une base mysql
    Par aboura86 dans le forum MySQL
    Réponses: 7
    Dernier message: 09/06/2008, 02h32
  3. Réponses: 1
    Dernier message: 05/03/2008, 21h41
  4. Stocker les sessions dans une base de données
    Par mic79 dans le forum Langage
    Réponses: 7
    Dernier message: 06/04/2006, 21h57
  5. Stocker du Php dans une base Mysql
    Par tibrus dans le forum Requêtes
    Réponses: 5
    Dernier message: 01/09/2005, 22h03

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo