$survey = json_decode($row['survey_json']); if (!isset($survey->geolocation->longitude) || !isset($survey->geolocation->latitude)) { continue; } // create a point feature $feature = new stdClass(); $features[] = $feature; $feature->id = $survey_key; $feature->type = "Feature"; $feature->geometry = new stdClass(); $feature->geometry->type = "Point"; $feature->geometry->coordinates = [$survey->geolocation->longitude, $survey->geolocation->latitude]; // add some properties to it $feature->properties = new stdClass(); // we get some properties from the original survey object $feature->properties->title = $row['username'] . " on " . getDateStringFromSurvey($survey); $feature->properties->user_key = $row['user_key']; $feature->properties->public_visible = $row['public']; if ($row['osm_address_json']) { $osm_address = json_decode($row['osm_address_json']); $feature->properties->osm_address_place_id = $osm_address->place_id; $feature->properties->osm_address_id = $osm_address->osm_id; $feature->properties->osm_address_display_name = $osm_address->display_name; if (isset($osm_address->address)) { if (isset($osm_address->address->postcode)) { $feature->properties->osm_address_postcode = $osm_address->address->postcode; } if (isset($osm_address->address->country_code)) { $feature->properties->osm_address_country_code = $osm_address->address->country_code; } }
$survey = json_decode($row['survey_json']); // set up the location so the popup will be displayed if (isset($survey->geolocation->longitude) && isset($survey->geolocation->latitude)) { $center_lon = $survey->geolocation->longitude; $center_lat = $survey->geolocation->latitude; $zoom = 15; } // social media here we come $social_title = 'A Ten Breaths Place by ' . $row['display_name'] . ' on ' . getDateStringFromSurvey($survey); // set up the facebook meta tagging so fb can crawl the page $fb_tags['og:url'] = get_server_uri() . 'survey-' . $survey_key; $fb_tags['og:type'] = 'place'; $fb_tags['og:site_name'] = 'Ten Breaths Map'; $fb_tags['place:location:latitude'] = $survey->geolocation->latitude; $fb_tags['place:location:longitude'] = $survey->geolocation->longitude; $social_title = 'A Ten Breaths Place by ' . $row['display_name'] . ' on ' . getDateStringFromSurvey($survey); $fb_tags['og:title'] = $social_title; $twitter_tags['twitter:title'] = $social_title; if (isset($survey->textComments)) { $comment = $survey->textComments; if (strlen($comment) > 0) { $fb_tags['og:description'] = $survey->textComments; $twitter_tags['twitter:description'] = $survey->textComments; } } if ($row['photo']) { $image_url = get_server_uri() . 'data/' . $row['photo']; $fb_tags['og:image'] = $image_url; $twitter_tags['twitter:image'] = $image_url; } // set up the twitter card specific meta tagging