Exploring the functionality of the helper function called turf.point()
const feature = turfHelpers.point(coords, properties, { id: properties.id });
The structure of the variable properties
is as follows:
properties = {
id: 1,
thisWorks: 'no problem'
foo: {
thisDoesntWork: 'this is a problem'
}
}
Upon creating the feature
using turfHelpers.point()
, the object is altered. The nested object is no longer recognized as an object
, but instead gets converted to a string...
Therefore, now features.properties
appears like this:
{
id: 1,
thisWorks: 'no problem'
foo: "{
thisDoesntWork: 'this is a problem'
}"
}
Subsequently, it becomes impossible to access
feature.properties.foo.thisDoesntWork
since it has been turned into a string... What could be the reason for this behavior exhibited by turf.js
?