I'm wondering if anyone can help me to understand if there is a way to convert an existing feature's geometry type? The reason for this is outlined in a previous question but basically when I drop a gpx file onto the map I need to convert certain 'routes' to shapes.
The API indicates that there is a setGeometry() function but I can't get it to work and there are no examples to draw from. Below are the methods I've tried so far.
feature.setGeometry(ol.geom.Polygon); feature.setGeometry('Polygon'); feature.setGeometry(geometry, ol.geom.Polygon); feature.values_.geometry = ol.geom.Polygon; feature.getGeometry().setType('Polygon');
This might be a kludge but the only other alternative as far as I can tell is to parse every gpx element manually which will involve essentially replicating all the existing code in order to catch this error.