title: Combination of Nominatim Openstreetmap Service and Tom MacWright's leaflet leaflet-knn
body: <p>I'd like to combine these tools: <a href="https://github.com/stefanocudini/leaflet-search" rel="nofollow noreferrer">Leaflet control search</a>, <a href="https://github.com/mapbox/leaflet-knn" rel="nofollow noreferrer">leaflet-knn</a> and <a href="https://github.com/perliedman/leaflet-routing-machine" rel="nofollow noreferrer">leaflet routing machine</a>.</p>
  
  <p>The first one will get me a point over the street I searched for and the second one will find its closest neighbour. The final step is to navigate using leaflet routing machine.</p>
  
  <p>After the first step I need to find how to use the point's coordinates (the one over the street I mentioned before) in order to complete the knn search (to find the closest neighbour)and finally navigate to it (to the closest neighbour)</p>
  
  <p>I've got a js fiddle but I'm not sure I used it right:
  <a href="https://jsfiddle.net/mbatsaris/xfcs77wm/" rel="nofollow noreferrer">https://jsfiddle.net/mbatsaris/xfcs77wm/</a>
  and this json file also.
  Any help would be highly appreciated. Thank you.</p>
  
  <pre><code>var camps = [
  {
  "type": "FeatureCollection",
  "crs": { "type": "name", "properties": { "name":"urn:ogc:def:crs:OGC:1.3:CRS84" } },
  
  "features": [
  { "type": "Feature", "properties": { "X": 748287.576139, "Y": 4187057.960012, "aa": 15299, "onoma": "3ο ΔΗΜΟΤΙΚΟ ΣΧΟΛΕΙΟ ΧΙΟΥ", "long": 26.134146, "lat": 38.377453 }, "geometry": { "type": "Point", "coordinates": [ 26.134146, 38.377453 ] } },
  { "type": "Feature", "properties": { "X": 748287.576139, "Y": 4187057.960012, "aa": 15300, "onoma": "11ο ΔΗΜΟΤΙΚΟ ΣΧΟΛΕΙΟ ΧΙΟΥ", "long": 26.136081, "lat": 38.368424 }, "geometry": { "type": "Point", "coordinates": [ 26.136081, 38.368424 ] } },
  { "type": "Feature", "properties": { "X": 748287.576139, "Y": 4187057.960012, "aa": 15301, "onoma": "4ο ΔΗΜΟΤΙΚΟ ΣΧΟΛΕΙΟ ΧΙΟΥ", "long": 26.134146, "lat": 38.377453 }, "geometry": { "type": "Point", "coordinates": [ 26.134146, 38.377453 ] } },
  { "type": "Feature", "properties": { "X": 685890.486674, "Y": 4246925.893043, "aa": 15152, "onoma": "ΓΥΜΝΑΣΙΟ ΧΙΟΥ ΕΣΠΕΡΙΝΟ", "long": 26.129116, "lat": 38.353775 }, "geometry": { "type": "Point", "coordinates": [ 26.129116, 38.353775 ] } },
  { "type": "Feature", "properties": { "X": 686171.208737, "Y": 4247801.345465, "aa": 15163, "onoma": "2ο ΕΝΙΑΙΟ ΛΥΚΕΙΟ ΧΙΟΥ", "long": 26.132558, "lat": 38.361601 }, "geometry": { "type": "Point", "coordinates": [ 26.132558, 38.361601 ] } },
  { "type": "Feature", "properties": { "X": 686175.616517, "Y": 4247807.332267, "aa": 15144, "onoma": "2ο ΓΥΜΝΑΣΙΟ ΧΙΟΥ", "long": 26.132610, "lat": 38.361654 }, "geometry": { "type": "Point", "coordinates": [ 26.13261, 38.361654 ] } },
  { "type": "Feature", "properties": { "X": 686497.839566, "Y": 4247865.195934, "aa": 15302, "onoma": "ΔΗΜΟΤΙΚΟ ΣΧΟΛΕΙΟ ΧΙΟΥ ΕΙΔΙΚΟ", "long": 26.136311, "lat": 38.362108 }, "geometry": { "type": "Point", "coordinates": [ 26.136311, 38.362108 ] } },
  { "type": "Feature", "properties": { "X": 686711.220038, "Y": 4247881.353276, "aa": 15209, "onoma": "1ο ΣΕΚ ΧΙΟΥ", "long": 26.138756, "lat": 38.362209 }, "geometry": { "type": "Point", "coordinates": [ 26.138756, 38.362209 ] } },
  { "type": "Feature", "properties": { "X": 686707.151767, "Y": 4247883.368693, "aa": 15207, "onoma": "2ο ΤΕΕ ΧΙΟΥ", "long": 26.138710, "lat": 38.362228 }, "geometry": { "type": "Point", "coordinates": [ 26.13871, 38.362228 ] } },
  { "type": "Feature", "properties": { "X": 686703.695145, "Y": 4247885.398287, "aa": 15203, "onoma": "1ο ΤΕΕ ΧΙΟΥ", "long": 26.138671, "lat": 38.362247 }, "geometry": { "type": "Point", "coordinates": [ 26.138671, 38.362247 ] } },
  { "type": "Feature", "properties": { "X": 686654.965932, "Y": 4247917.025023, "aa": 15167, "onoma": "3ο ΕΝΙΑΙΟ ΛΥΚΕΙΟ ΧΙΟΥ", "long": 26.138122, "lat": 38.362542 }, "geometry": { "type": "Point", "coordinates": [ 26.138122, 38.362542 ] } },
  { "type": "Feature", "properties": { "X": 686654.965932, "Y": 4247917.025023, "aa": 15178, "onoma": "1ο ΕΝΙΑΙΟ ΛΥΚΕΙΟ ΧΙΟΥ", "long": 26.138122, "lat": 38.362542 }, "geometry": { "type": "Point", "coordinates": [ 26.138122, 38.362542 ] } },
  { "type": "Feature", "properties": { "X": 686300.009009, "Y": 4248087.688735, "aa": 15111, "onoma": "4ο ΓΥΜΝΑΣΙΟ ΧΙΟΥ", "long": 26.134107, "lat": 38.364153 }, "geometry": { "type": "Point", "coordinates": [ 26.134107, 38.364153 ] } },
  { "type": "Feature", "properties": { "X": 686551.258503, "Y": 4248102.941494, "aa": 15393, "onoma": "ΚΕΣΥΠ ΧΙΟΥ", "long": 26.136985, "lat": 38.364238 }, "geometry": { "type": "Point", "coordinates": [ 26.136985, 38.364238 ] } },
  { "type": "Feature", "properties": { "X": 686359.882885, "Y": 4248125.937899, "aa": 15150, "onoma": "1ο ΓΥΜΝΑΣΙΟ ΧΙΟΥ", "long": 26.134802, "lat": 38.364485 }, "geometry": { "type": "Point", "coordinates": [ 26.134802, 38.364485 ] } },
  { "type": "Feature", "properties": { "X": 684887.838361, "Y": 4260691.808672, "aa": 15311, "onoma": "6ο ΔΗΜΟΤΙΚΟ ΣΧΟΛΕΙΟ ΧΙΟΥ", "long": 26.131517, "lat": 38.365979 }, "geometry": { "type": "Point", "coordinates": [ 26.131517, 38.365979 ] } },
  { "type": "Feature", "properties": { "X": 684887.838361, "Y": 4260691.808672, "aa": 15313, "onoma": "9ο ΔΗΜΟΤΙΚΟ ΣΧΟΛΕΙΟ ΧΙΟΥ", "long": 26.133857, "lat": 38.384268 }, "geometry": { "type": "Point", "coordinates": [ 26.133857, 38.384268 ] } },
  { "type": "Feature", "properties": { "X": 684887.838361, "Y": 4260691.808672, "aa": 15314, "onoma": "8ο ΔΗΜΟΤΙΚΟ ΣΧΟΛΕΙΟ ΧΙΟΥ", "long": 26.135080, "lat": 38.375425 }, "geometry": { "type": "Point", "coordinates": [ 26.13508, 38.375425 ] } },
  { "type": "Feature", "properties": { "X": 684887.838361, "Y": 4260691.808672, "aa": 15315, "onoma": "7ο ΔΗΜΟΤΙΚΟ ΣΧΟΛΕΙΟ ΧΙΟΥ", "long": 26.130533, "lat": 38.370493 }, "geometry": { "type": "Point", "coordinates": [ 26.130533, 38.370493 ] } },
  { "type": "Feature", "properties": { "X": 686111.689855, "Y": 4248328.528558, "aa": 15318, "onoma": "1ο ΔΗΜΟΤΙΚΟ ΣΧΟΛΕΙΟ ΧΙΟΥ", "long": 26.132163, "lat": 38.365841 }, "geometry": { "type": "Point", "coordinates": [ 26.132163, 38.365841 ] } },
  { "type": "Feature", "properties": { "X": 686817.400932, "Y": 4248207.323567, "aa": 15319, "onoma": "2ο ΔΗΜΟΤΙΚΟ ΣΧΟΛΕΙΟ ΧΙΟΥ", "long": 26.140098, "lat": 38.365023 }, "geometry": { "type": "Point", "coordinates": [ 26.140098, 38.365023 ] } }
  ]}];
  </code></pre>