diff --git a/.DS_Store b/.DS_Store index 77ef86f..9b94a22 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/wp-geoutil.php b/wp-geoutil.php index 329b89f..f967f44 100644 --- a/wp-geoutil.php +++ b/wp-geoutil.php @@ -488,8 +488,8 @@ public static function metaval_to_geom( $metaval = false, $force_multi = false ) if ( $force_multi && false === strpos( $wkt, 'MULTI' ) ) { if ( 0 === strpos( $wkt, 'POINT' ) ) { $wkt = preg_replace( '@^POINT@','MULTIPOINT', $wkt ); - } else if ( 0 === strpos( $wkt, 'LINESTRING' ) || 0 === strpos( $wkt, 'POLYGON' ) ) { - $wkt = preg_replace( '@^(LINESTRING|POLYGON)(\s*)(\(.*?\)[^,])@','MULTI$1$2($3)', $wkt ); + } else if ( 0 === strpos( $wkt, 'LINE' ) || 0 === strpos( $wkt, 'POLYGON' ) ) { + $wkt = preg_replace( '@^(LINE|POLYGON)(\s*)(\(.*?\)[^,])@','MULTI$1$2($3)', $wkt ); } } @@ -705,7 +705,7 @@ public static function get_srid() { * @param array $arguments The arguments for the function. */ public static function __callStatic( $name, $arguments ) { - if ( in_array( strtolower( $name ), self::get_capabilities(), true ) ) { + if ( in_array( strtolower( $name ),array_merge( self::get_capabilities(),array("linestring","point")), true ) ) { return self::run_spatial_query( $name, $arguments ); } } @@ -739,7 +739,7 @@ private static function run_spatial_query( $name, $arguments = array() ) { $maybe_geom = self::metaval_to_geom( $arg ); if ( false !== $maybe_geom ) { $arguments[ $idx ] = $maybe_geom; - $q .= 'ST_GeomFromText(%s)'; + $q .= 'ST_GeomCollFromText(%s)'; } else { $q .= '%s'; }