remove

return type jQuery collection
syntax .geomap( "remove", Object shape ( GeoJSON object ) | Array<Object> shapes [ , Boolean refresh ] )
usage
$( map or service selector ).geomap( "remove", existingShape )
$( map or service selector ).geomap( "remove", existingShape, false )
$( map or service selector ).geomap( "remove", [ existingShape1, existingShape2 ] )

The remove method removes a shape (or array of shapes) that you have previously added with the append method. The existing shapes can be an object references used in a call to append which you have held on to or ones that you retrieved by using the find method.

The jQuery UI widget factory returns the original jQuery collection to maintain call chaining.

delaying refresh

The optional refresh argument determines if geomap refreshes the map graphics after this call to remove. It defaults to true. If you pass false, geomap will remove the shape internally but not immediately redraw the graphics. The changes will display if the user moves the map or you call geomap's refresh method.

If the shape is not found on the specified service, the map is not changed and will not be refreshed even if you pass true for the refresh argument.

service-level shapes

Similar to how you can append shapes to specific services, you can remove shapes from specific services as well.

You do this by targeting a service inside a map instead of the map itself for your call to geomap's remove method. For example, the default map service has the CSS class: osm. We can remove a shape from that service specifically by using jQuery to target the service:

$( "#map .osm" ).geomap( "remove", shape );

Shapes appended to a specific service will not be removed by calling remove on the map itself. For example, the shape will remain after this sequence:

$( "#map .osm" ).geomap( "append", shape );
$( "#map" ).geomap( "remove", shape );

To remove all references to a shape from the map and all services, you can use the comma selector and the built-in geo-service CSS class:

// remove the shape from both the map widget and any services
$( "#map,#map .geo-service" ).geomap( "remove", shape );