The mechanism for modifying features in OpenLayers 3, similar to OpenLayers.Control.ModifyFeature in OpenLayers 2, has been added to the trunk and is called ol.interaction.Modify. Here is an example of modifying features only.
There is also a an example of combining draw and modify together, which uses an ol.FeatureOverlay, rather than ol.source.Vector, so that this can be passed to both the constructors for ol.interaction.Modify
and ol.interaction.Draw
, so that they can operate on the same vector objects and be simultaneously enabled. There is a method that looks for a shift press and single click to enable deleting a vertex.
Sorry for reviving an old thread, the same question came up in the context of the geopackage specification so I thought I might as well answer it here too.
The reason you need all these empty geometry types is because the ISO SQL/MM part 3 specification requires them (not explicitly, but indirectly).
As an example ST_Intersection
needs to be able to return a 'there is no intersection' value. The type of the returned value (what ST_GeometryType
will return when called on the value) depends on the argument types.
ST_Intersection(ST_GeomFromText('POINT (1 1)'), ST_GeomFromText('POINT (0 0)')
for instance is specified in section 5.1.22 as returning 'an empty set of type point'. So this needs to return a valid ST_Geometry
value, ST_IsEmpty
should return true
for it and ST_GeometryType
should return ST_Point
.
So what should you get when you execute ST_AsText
and ST_AsBinary
on that returned value? For WKT the only correct answer I think is POINT EMPTY
.
For WKB this is poorly defined. WKB does not provide an equivalent of WKT's EMPTY
and points don't have a natural empty representation. This is why in GeoPackage there's an empty header bit and it's required to use NaN
as the coordinates of the point. The intention is to avoid people accidentally using empty point sets as a regular point value. NaN works as an absorbing element, so it's pretty obvious when you've made a mistake since the outcome of your calculations is very likely to be NaN as well.
Note that in many implementations, like PostGIS for instance, the above example will return GEOMETRYCOLLECTION EMPTY
instead. That's strictly speaking not compliant with the ISO spec since the type of the return value is not correct.
So to answer the question 'why do you have all these different empty types in WKT and WKB'? Because WKT and WKB are, as far as I know, defined in the SQL/MM part 3 specification, that specification defines distinct typed empty sets for each geometry type and as a consequence WKT and WKB need to have a representation for these typed empty sets.
Best Answer
An update to the answer
Nowadays, OpenLayers 3 support WKT whereas as pointed by @chrki it wasn't possible before.
See the API docs and the WKT demo in action from the official samples.