I am creating a node application and using TopoJSON server API reference (see the link below) to convert a GeoJSON object to a TopoJSON object.
I used these three lines of code below which returns the TopoJSON topology but without returning the properties from the GeoJSON object.
var collection = {type: "FeatureCollection", features: […]}; // GeoJSON
var topology = topojson.topology({collection: collection}); // convert to TopoJSON
console.log(topology.objects.collection); // inspect TopoJSON
However, I also want to include the properties of each topology to the final TopoJSON object, and according to the API, I need to use this function below copy all properties from the GeoJSON object:
function propertyTransform(properties, key, value) {
properties[key] = value;
return true;
}
But my issue is I don't know how to use this propertyTransform function as an option inside of the topojson.topology() function in order to return the TopoJSON object with properties.
Does anyone know how to do it or provide me some example code?
Thanks a lot!
Vanni