I have some code that needs to be transcribed from another system, so unfortunately I can't easily share it here. If I could, I would just post the entire project.
Recently, I attempted to integrate into our project but encountered error messages.
TS2345: Arguments of type 'FeatureCollection < Geometry | GeometryCollection, {[name:string]: any; } is not assignable to parameter of type 'FeatureCollection < Point, {[name:string]: any;} > '
Type Geometry is not assignable to type Point Type of property type are incompatible Type string is not assignable to type Point
I came across this thread turf.nearestPoint only returning the same point, where a user shared:
map.on('click', function(e) {
var coord = e.latlng;
var lat = coord.lat;
var lng = coord.lng;
var targetPoint = turf.point([lng, lat]);
var nearest = turf.nearestPoint(targetPoint, points);
alert(JSON.stringify(nearest));
});
In my implementation, I am:
Utilizing a mouse click event to create a selectPoint using turf.point([lng, lat])
Generating my points from an array also created with the approach turf.point([lng, lat])
Unfortunately, I continue to receive the TS error mentioned above.
Furthermore, the Turf documentation indicates that targetPoint should be a Coord while the example code uses Turf.point which is a Feature.
Arguments
Argument------Type------Description
targetPoint----Coord-----the reference point
points------FeatureCollection< Point >------against input point set
After spending over 8 hours trying to troubleshoot this issue, I'm feeling beyond frustrated and doubting all my efforts today.
If anyone can offer assistance or point me towards a reliable solution without cryptic jargon meant for tech experts, I would greatly appreciate it.