I want to make a cluster with a GeoJSON, to obtain the file I query a table in PostgreSQL and I save the file. The same point can have several associated images, but according to the GeoJSON, it makes a record for each one and the cluster understands it as independent points. If there are several images at a point, can they be grouped into a single feature? It's my sample GeoJSON, you can se the id_observation 51, is the same observation with two images
{
"type":"Feature",
"id":22,
"properties":{
"a_code":"151",
"name":"one Name",
"id_observation":"51",
"long_4326":"-x.xxx",
"lat_4326":"xx.xxx",
"obs_date":"2015-03-17",
"id_observation_font":"1",
"id_image_observation":"30",
"main_co":"f",
"author":"John",
"image":"data/IMG1.JPG",
"geojson":"{\"type\":\"Point\",\"coordinates\":[-x.x,xx.xx]}"},
"geometry":{
"type":"Point",
"coordinates":[-x.x,xx.xx]}
},
{
"type":"Feature",
"id":23,
"properties":{
"a_code":"151",
"name":"one Name",
"id_observation":"51",
"long_4326":"-x.xxx",
"lat_4326":"xx.xxx",
"obs_date":"2015-03-17",
"id_observation_font":"1",
"id_image_observation":"29",
"main_co":"f",
"author":"John",
"image":"data/IMG2.JPG",
"geojson":"{\"type\":\"Point\",\"coordinates\":[-x.x,xx.xx]}"},
"geometry":{
"type":"Point",
"coordinates":[-x.x,xx.xx]}
},
{
"type":"Feature",
"id":24,
"properties":{
"a_code":"715",
"name":"other name",
"id_observation":"52",
"long_4326":"-x.xxx",
"lat_4326":"xx.xxx",
"obs_date":"2015-06-01",
"id_observation_font":"1",
"id_image_observation":"31",
"main_co":"t",
"author":"Phill",
"image":"data/IMG32.JPG",
"geojson":"{\"type\":\"Point\",\"coordinates\":[-x.x,xx.xx]}"},
"geometry":{
"type":"Point","coordinates":[-x.x,xx.xx]}
}
This is my sample query
$query = "Select a_code, name, id_observation, long_4326, lat_4326, obs_date, id_observation_font,
id_image_observation, main_co, author, image, ST_AsGeoJSON(geom, 7) AS geojson FROM observations WHERE id_observation_font != 3 ORDER BY id_observation";
$result = pg_query($query) or die('Query failed: ' . pg_last_error());
$geojson = array(
'type' => 'FeatureCollection',
'features' => array()
);
$i = 0;
while ($line = pg_fetch_assoc($result)) {
$feature = array(
'type' => 'Feature',
'id' => $i++,
'properties' => $data[]=$line,
'geometry' => json_decode($line['geojson'], true),
);
array_push($geojson['features'], $feature);
}
$localiza = json_encode($geojson, JSON_UNESCAPED_UNICODE);
$conta = "../data/observations.json";