Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
project:electronomy [2013/03/22 17:22] – [Code] bernara3project:electronomy [2013/03/22 17:31] – [Code] bernara3
Line 32: Line 32:
  
   * List and link your actual and ideal data sources.   * List and link your actual and ideal data sources.
 +
 +===== Capture d'écran =====
 +
 +===== Captures =====
 +
 +{{:project:capture_d_e_cran_2013-03-22_a_17.23.03.png?200|}}
 +{{:project:map_large.png?200|}}
 +
  
 ===== Code ===== ===== Code =====
 +
 +Index.html :
  
 <code html> <code html>
Line 118: Line 128:
 </code> </code>
  
-Problèmes à regler centroid +GetCentroid.html 
-Manque plus que le for each+ 
 +<code html> 
 +<html> 
 +<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> 
 + 
 +<script> 
 +$(document).ready(function() { 
 + var url = 'http://api.geo.admin.ch/main/wsgi/swisssearch/geocoding'; 
 +   
 +  // A completer par le npa de toutes les communes 
 +  var test = new Array(); 
 +  test[0] = 3960; 
 +  test[1] = 1920; 
 +  test[2] = 1950; 
 +   
 +  for (var i=0;i<test.length;i++){ 
 + 
 +     $.getJSON(url + '?query=' +  test[i] +'&services=postalcodes&no_geom=false', function(data) { 
 +     $.each(data.results, function(key, val){ 
 +     var content = "NPA: " +val.nr+ "<br/>"; 
 +     content += "Label: " +val.label+ "<br/>"; 
 +     var coord = new Array(); 
 +     $.each(val.bbox, function(i,j){ 
 +     coord[i] = j; 
 +     }); 
 + 
 +     // Avoir la longitude et latitude de la commune 
 +     content += coord[0]+6400+" | "; 
 +     content += coord[1]+6400; 
 +     content += "<br/>"; 
 +     $('#data').append(content); 
 +     }); 
 +     });  
 +
 +}); 
 +</script> 
 +<body> 
 + <div id="data"></div> 
 +</body> 
 +</html> 
 +</code> 
 + 
 +  * Problèmes à regler centroid 
 +  Manque plus que le for each sur chaque communes
 ===== Team ===== ===== Team =====
  
  • project/electronomy.txt
  • Last modified: 2013/08/15 22:23
  • by loleg