Leaflet.js has a vector layer option for rectangles, http://leafletjs.com/reference.html#rectangle. The attached patch adds that functionality to the leaflet module, so when defining features, you can just pass in:

    $features[] = array(
      'type' => 'rectangle',
      'bounds' => array(
        'n' => 123,
        's' => 123,
        'e' => 123,
        'w' => 123,
      ),
      'settings' => array(
        'color' => '#ee9900',
        'clickable' => FALSE,
        'fillOpacity' => 0.3,
      ),
    );
CommentFileSizeAuthor
leaflet-rectangle-feature.patch948 bytesjnettik

Comments

jnettik’s picture

  • RdeBoer committed 757bd0c on 7.x-1.x authored by jnettik
    Issue #2510800 by jnettik: Allow for use of L.rectangle()
    
rdeboer’s picture

Title: Allow for use of L.rectangle() » Allow for use of L.Rectangle()
Assigned: Unassigned » rdeboer
Status: Needs review » Fixed

Thanks @jnettik!

Patch applied.

Available now in Leaflet 7.x-1.x-dev and in 7.x-1.2 and later once released.

Rik

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.