Hello,
I am trying to add a linestring feature to a set of features that already has points. The linestring is not rendering. I'm trying to follow the code from leaflet_views.api.php where it says "linestring" is a valid feature type. This is where I get a little lost though. Here's how I'm adding the feature:
// add linestring
$features[] = [
'type' => 'linestring',
'points' => [[$lat1,$lng1],[$lat2,$lng2]],
'coordinates' => [[$lat1,$lng1],[$lat2,$lng2]],
'leaflet_id' => 'ls-'.$lrid.'-'.$crid,
];
I added the 'coordinates' key first but then got an error that "length" of "points" couldn't be determined, so I tried putting in a "points" key. That clears the error but still no linestring. I'm looking at LeafletService.php but can't get anywhere.
I'm adding the map like this:
$map_info = leaflet_map_get_info("mymodule_map");
$content['map'] = \Drupal::service('leaflet.service')->leafletRenderMap($map_info, $features, '480px');
Thanks for any pointers!