예제 #1
0
 public static function fromString($wktArgument)
 {
     $geometry_strings = preg_split('/,\\s*(?=[A-Za-z])/', $wktArgument);
     return new static(array_map(function ($geometry_string) {
         $klass = Geometry::getWKTClass($geometry_string);
         return call_user_func($klass . '::fromWKT', $geometry_string);
     }, $geometry_strings));
 }
예제 #2
0
 public function setRawAttributes(array $attributes, $sync = false)
 {
     $spatialFields = $this->getSpatialFields();
     foreach ($attributes as $attribute => &$value) {
         if (in_array($attribute, $spatialFields) && is_string($value) && strlen($value) >= 15) {
             $value = Geometry::fromWKB($value);
         }
     }
     parent::setRawAttributes($attributes, $sync);
 }