Custom details for GeoJSON object for dynamicObjectMixin

I'd like to replace the default GeoJSON descriptions for the dynamicObjectMixin to display the details when the GeoJSON point is clicked. It doesn't seem like there is an easy way to do this, but I thought I'd ask before I go roll my own. I'm planning to import several GeoJSON layers and I might want a different mapping from GeoJSON to descriptive html for each.

Thanks,
  Carl

You’re right, there’s not currently a good way to hook into to creation of the description properties for GeoJSON objects.

One thing you could do is loop over the dynamic objects after the GeoJSON is loaded and overwrite the description properties with new properties containing whatever HTML you want. For example:

var objects = dataSource.getDynamicObjectCollection();

for (var i = 0; i < objects.length; ++i) {

var dynamicObject = objects[i];

var description = createDescription();

// create whatever HTML you want. The original geoJson object is available as dynamicObject.geoJson

dynamicObject.description = new ConstantProperty(description);

}