Skip to content

Commit

Permalink
Merge branch 'develop' into USH-1279
Browse files Browse the repository at this point in the history
  • Loading branch information
Mh-Asmi authored Apr 25, 2024
2 parents a558328 + 1c68a4a commit 3f4e1aa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,26 @@ class PostGeometryResource extends BaseResource
*/
public function toArray($request)
{
$map_config = service('map.config');

if (is_a($this->resource, "stdClass")) {
$data = (array) $this->resource;
} else {
$data = $this->resource->toArray();
}

$data['geojson'] = json_decode($data['geojson'], true);

if (isset($data['hide_location']) && $data['hide_location']) {
foreach ($data['geojson']['features'] as $key => $feature) {
$feature['geometry']['coordinates'][0] =
round($feature['geometry']['coordinates'][0], $map_config['location_precision']);
$feature['geometry']['coordinates'][1] =
round($feature['geometry']['coordinates'][1], $map_config['location_precision']);
$data['geojson']['features'][$key] = $feature;
}
}
unset($data['hide_location']);
return $data;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ private function getGeoJsonQuery(PostSearchFields $search_fields = null)
$select_raw .= ",Max(IFNULL(messages.type,'web')) as source
,Max(messages.data_source_message_id) as 'data_source_message_id'";
$select_raw .= ",Max(forms.color) as 'marker-color'";
$select_raw .= ",Max(forms.hide_location) as 'hide_location'";
$select_raw .= ",CONCAT(
'{\"type\":\"FeatureCollection\",'
,'\"features\":[',
Expand Down

0 comments on commit 3f4e1aa

Please sign in to comment.