Bonjour,
J’ai essayé cette méthode, mais sans succès.
Mon fichier GeoJSON comporte les points et les lignes comme suit:
var waypoints = {"type": "FeatureCollection", "features":[
{"type": "Feature", "geometry":{"type": "Point","coordinates":[2.602011,48.998318]},"properties":{"name":"LFPG"}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[1.220861,49.031696]},"properties":{"name":"EVX"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[2.602011,48.998318],[1.220861,49.031696]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-0.455000,49.928333]},"properties":{"name":"ANGLO"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[1.220861,49.031696],[-0.455000,49.928333]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-2.005006,49.999172]},"properties":{"name":"ORTAC"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-0.455000,49.928333],[-2.005006,49.999172]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-4.330153,49.590343]},"properties":{"name":"LIZAD"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-2.005006,49.999172],[-4.330153,49.590343]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-6.150792,49.529911]},"properties":{"name":"AMPOP"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-4.330153,49.590343],[-6.150792,49.529911]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-8.000000,49.500000]},"properties":{"name":"RATKA"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-6.150792,49.529911],[-8.000000,49.500000]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-15.000000,50.500000]},"properties":{"name":"RODEL"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-8.000000,49.500000],[-15.000000,50.500000]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-20.000000,51.000000]},"properties":{"name":"5120N"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-15.000000,50.500000],[-20.000000,51.000000]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-30.000000,50.500000]},"properties":{"name":"H5030"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-20.000000,51.000000],[-30.000000,50.500000]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-40.000000,49.000000]},"properties":{"name":"4940N"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-30.000000,50.500000],[-40.000000,49.000000]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-50.000000,47.000000]},"properties":{"name":"4750N"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-40.000000,49.000000],[-50.000000,47.000000]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-56.709446,45.746387]},"properties":{"name":"GRAYY"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-50.000000,47.000000],[-56.709446,45.746387]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-60.000000,44.500000]},"properties":{"name":"N4460"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-56.709446,45.746387],[-60.000000,44.500000]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-64.390182,42.574501]},"properties":{"name":"ELERI"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-60.000000,44.500000],[-64.390182,42.574501]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-65.000000,42.000000]},"properties":{"name":"4265N"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-64.390182,42.574501],[-65.000000,42.000000]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-67.000000,41.000000]},"properties":{"name":"4167N"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-65.000000,42.000000],[-67.000000,41.000000]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-70.000000,40.000000]},"properties":{"name":"4070N"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-67.000000,41.000000],[-70.000000,40.000000]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-70.499451,39.352970]},"properties":{"name":"KENDA"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-70.000000,40.000000],[-70.499451,39.352970]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-71.710487,39.409760]},"properties":{"name":"LINND"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-70.499451,39.352970],[-71.710487,39.409760]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-72.830528,39.823357]},"properties":{"name":"OWENZ"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-71.710487,39.409760],[-72.830528,39.823357]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-73.861061,40.017303]},"properties":{"name":"CAMRN"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-72.830528,39.823357],[-73.861061,40.017303]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-73.756943,40.316193]},"properties":{"name":"CHANT"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-73.861061,40.017303],[-73.756943,40.316193]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-73.662560,40.484402]},"properties":{"name":"JAMCA"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-73.756943,40.316193],[-73.662560,40.484402]]}},
{"type": "Feature", "geometry":{"type": "Point","coordinates":[-73.778694,40.639927]},"properties":{"name":"KJFK"}},
{"type": "Feature","properties":{}, "geometry":{"type": "LineString","coordinates":[[-73.662560,40.484402],[-73.778694,40.639927]]}}]}