javascript - D3: Click on map and trace the closest path until the coast -
for application build, user can click on point of map, , nearest river path identified , animated until reaches coast. used d3 draw bunch of paths (rivers) geojson file, each path feature geometry type linestring. figured use d3's voronoi identify closest path when user clicks on point. biggest problem is, identify closest river segment, not sure how automatically trace rest of paths until reaches coast. example, can see in image attached, 1 path highlighted, paths after highlighted. idea create new geojson file possible stream paths (as whole, not individual segments), how create file file each individual segment path? provided 3 features geojson file @ end give idea of how current data organized
{"type": "featurecollection","crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:ogc:1.3:crs84" } },"features": [{ "type": "feature", "properties": { "arcid": 15, "grid_code": 1, "from_node": 4074, "to_node": 4069, "shape_leng": 24.8000011779 }, "geometry": { "type": "linestring", "coordinates": [ [ 128.257362464927638, 26.8747231358752 ], [ 128.257361002021611, 26.874947030137374 ] ] } },{ "type": "feature", "properties": { "arcid": 16, "grid_code": 1, "from_node": 4075, "to_node": 4070, "shape_leng": 24.8000011779 }, "geometry":{ "type": "linestring", "coordinates": [ [ 128.258485955739388, 26.874729034949482 ], [ 128.258484495046019, 26.87495292926857 ] ] } },{ "type": "feature", "properties": { "arcid": 23, "grid_code": 1, "from_node": 4083, "to_node": 4068, "shape_leng": 69.318110594900006 }, "geometry": { "type": "linestring", "coordinates": [ [ 128.256990163500433, 26.874385326154584 ], [ 128.256674423121041, 26.874943420716903 ] ] } }]}
Comments
Post a Comment