Skip to content

Instantly share code, notes, and snippets.

View mstenta's full-sized avatar
🥚

Michael Stenta mstenta

🥚
View GitHub Profile
@mstenta
mstenta / fix_longitudes_v2.php
Created September 7, 2022 20:02
Fix farmOS (v2) geometry longitudes per https://github.com/farmOS/farmOS/issues/33
<?php
$debug = TRUE;
// Function for recursively fixing the longitude points within a Geometry.
function recursive_fix_lon(&$feature) {
$fixed = FALSE;
if ($feature->geometryType() == 'Point' && !empty($feature->coords[0])) {
$lon = &$feature->coords[0];
$lon = fmod($lon, 360);
# $Id$
#
# LANGUAGE translation of Drupal (general)
# Copyright YEAR NAME <EMAIL@ADDRESS>
# Generated from files:
# /opt/drupal/web/profiles/farm/farm.install: n/a
# /opt/drupal/web/profiles/farm/modules/core/settings/src/Form/FarmSettingsModulesForm.php: n/a
# /opt/drupal/web/profiles/farm/farm.profile: n/a
# /opt/drupal/web/profiles/farm/modules/core/api/farm_api.info.yml: n/a
# /opt/drupal/web/profiles/farm/modules/core/ui/farm_ui.info.yml: n/a
@mstenta
mstenta / main.js
Last active November 9, 2019 20:57
import replaceToEPSG4326 from './replaceToEPSG4326';
replaceToEPSG4326();
@mstenta
mstenta / farmOS-api-20190320.md
Created March 20, 2019 20:39
farmOS API Discussion 2019-03-20

farmOS API Discussion 2019-03-20

Michael Stenta Jamie Gaehring Paul Weidner

Library links:

@mstenta
mstenta / parse-kml.php
Last active February 8, 2024 07:36 — forked from woodbri/parse-kml.php
Script to parse a kml file
<?php
// Enter the name of the KML file here.
$kml_filename = '';
$xml = simplexml_load_file($kml_filename);
$folders = $xml->Document->Folder;
foreach ($folders as $folder) {
print "Name: " . $folder->name . "\n";
print "Description: " . $folder->description . "\n";
@mstenta
mstenta / fix_longitudes.php
Last active September 7, 2022 20:03
Fix farmOS v1 geometry longitudes per https://github.com/farmOS/farmOS/issues/33
<?php
// Load GeoPHP.
geophp_load();
// Function for recursively fixing the longitude points within a Geometry.
function recursive_fix_lon(&$feature) {
$fixed = FALSE;
if ($feature->geometryType() == 'Point' && !empty($feature->coords[0])) {
$lon = &$feature->coords[0];