exec('SET NAMES utf8'); //$db->exec("SET time_zone = '+00:00'"); $fn=0; if(isset($_GET['fn'])) { $fn=$_GET['fn']; } if($fn=='1') //Перезаписать все координаты для геометрии { if(!isset($HTTP_RAW_POST_DATA)) { $HTTP_RAW_POST_DATA = file_get_contents("php://input"); } $object = json_decode($HTTP_RAW_POST_DATA); if($object->name=="TCheckPoint") { $sql="update main.routes_checkpoints set geom=ST_GeomFromText('POLYGON((".$object->points."))', 4326) where id=".$object->id; try { $db->query($sql); }catch (Exception $e) { sendError($e->getMessage()); } }else if($object->name=="TDetour") { $sql="update main.detours set geom=ST_GeomFromText('POLYGON((".$object->points."))', 4326) where id=".$object->id; try { $db->query($sql); }catch (Exception $e) { sendError($e->getMessage()); } }else if($object->name=="TRoute") { $sql="update main.routes set geom=ST_GeomFromText('LINESTRING(".$object->points.")', 4326) where id=".$object->id; try { $db->query($sql); }catch (Exception $e) { sendError($e->getMessage()); } }else if($object->name=="TGeofence") { $sql="update main.geofences set geom=ST_GeomFromText('POLYGON((".$object->points."))', 4326) where id=".$object->id; try { $db->query($sql); }catch (Exception $e) { sendError($e->getMessage()); } } /*json+='"id":'+feature.userFeature.userData.id+',\n'; json+='"name":"'+feature.userFeature.userData.constructor.name+'",\n'; json+='"points":"';*/ $json='{"errorCode":0}'; header('Content-Type: application/json'); echo $json; exit; }