Index: trunk/extensions/SemanticMaps/GeoCoords/SM_GeoCoordsValue.php |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | |
49 | 49 | // Only add the table when the SQL store is not a postgres database, and it has not been added by SMW itself. |
50 | 50 | if ( $smgUseSpatialExtensions && !array_key_exists( 'c', $fieldTypes ) ) { |
51 | | - $fieldTypes['c'] = 'Point'; |
| 51 | + $fieldTypes['c'] = 'Point NOT NULL'; |
52 | 52 | } |
53 | 53 | |
54 | 54 | return true; |
— | — | @@ -182,11 +182,8 @@ |
183 | 183 | $this->unstub(); |
184 | 184 | |
185 | 185 | if ( $smgUseSpatialExtensions ) { |
186 | | - // TODO |
187 | | - return array( |
188 | | - // GeomFromText() |
189 | | - str_replace( ',', '.', " POINT({$this->mCoordinateSet['lat']} {$this->mCoordinateSet['lon']}) " ) |
190 | | - ); |
| 186 | + $point = str_replace( ',', '.', " POINT({$this->mCoordinateSet['lat']} {$this->mCoordinateSet['lon']}) " ); |
| 187 | + return array( "GeomFromText( '$point' )" ); |
191 | 188 | } |
192 | 189 | else { |
193 | 190 | return array( |
Index: trunk/extensions/SemanticMaps/GeoCoords/SM_GeoCoords.php |
— | — | @@ -22,6 +22,7 @@ |
23 | 23 | // Hook for initializing the Geographical Coordinate type. |
24 | 24 | $wgHooks['smwInitDatatypes'][] = 'SMGeoCoordsValue::initGeoCoordsType'; |
25 | 25 | |
| 26 | +// Hook for initializing the field types needed by Geographical Coordinates. |
26 | 27 | $wgHooks['SMWCustomSQLStoreFieldType'][] = 'SMGeoCoordsValue::initGeoCoordsFieldTypes'; |
27 | 28 | |
28 | 29 | // Hook for defining a table to store geographical coordinates in. |