Add geopoint (GeoJSON) extension to AS JSON output
This commit is contained in:
parent
e84b01c76f
commit
97af5e1954
|
@ -447,6 +447,24 @@ class Activity
|
||||||
$activity[$objectName] = $props;
|
$activity[$objectName] = $props;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* more extensions */
|
||||||
|
|
||||||
|
if (!empty($this->context)) {
|
||||||
|
|
||||||
|
if (!empty($this->context->location)) {
|
||||||
|
$loc = $this->context->location;
|
||||||
|
|
||||||
|
// GeoJSON
|
||||||
|
|
||||||
|
$activity['geopoint'] = array(
|
||||||
|
'type' => 'Point',
|
||||||
|
'coordinates' => array($loc->lat, $loc->lon)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return array_filter($activity);
|
return array_filter($activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -714,6 +714,18 @@ class ActivityObject
|
||||||
$object[$objectName] = $props;
|
$object[$objectName] = $props;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GeoJSON
|
||||||
|
|
||||||
|
if (!empty($this->geopoint)) {
|
||||||
|
|
||||||
|
list($lat, $long) = explode(' ', $this->geopoint);
|
||||||
|
|
||||||
|
$object['geopoint'] = array(
|
||||||
|
'type' => 'Point',
|
||||||
|
'coordinates' => array($lat, $long)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return array_filter($object);
|
return array_filter($object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user