10376 Posts in 2191 Topics by 1708 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1181 Views |
-
GIS Module Help

20 September 2010 at 5:11pm
Hey guys,
The web app i'm building needs pretty heavy geolocation features so i've turned to the GIS module. It installed fine and the points are available - when I declare a DBField a GeoPoint it comes up in PhpMyAdmin as a field type point, from there, however the behaviour gets weird. I'm using the class methods to set lat and lng but from what I can tell all it's actually setting is this " Rew??F??sCSvPe@" weird unicode string, and not exhibitng the behaviour that the mysql docs say. I've tried using the setLat and setLng methods and as far as php is concerned they work, but then this is what gets set into the db. for now i'm just going to declare lat/lng number columns, but is there something i'm missing? is there a better way to do this? do you need code sample? is this module still supported?
Thanks,
Chris -
Re: GIS Module Help

22 September 2010 at 9:41am
just bumping in the hope that i'm not the only person to use this module
-
Re: GIS Module Help

22 September 2010 at 7:19pm
Haven't tried the module much myself and only then I used Postgres rather than MySQL but what happens if you manually set the GeoPoint in the database (eg via a UPDATE command). Does the data in the table display correctly? Could be an encoding issue perhaps? depending if your database is in UTF-8 or not.
-
Re: GIS Module Help

23 September 2010 at 4:03am
Hi te_chris,
i'm, too, stuck with gis module atm.
I can save to DB via GoogleGeocoder and it's aved as a "weird" string in DB, which is normal.
A query like
SELECT ID, AsText( Location ) FROM StandortPage
returns the data human readable like
ID AsText(Location)
17 POINT(13.621356 47.7132193)The problem is to get the data out of the database using DataObject ;)
From what i found so far is that GeoDBField::addToSQL() is NOT called.
It should be called in DataObject.php around line 2585
if($compositeFields) foreach($compositeFields as $k => $v) {
$dbO = $this->dbObject($k);
if($dbO) $dbO->addToQuery($query);But $dbO is empty, maybe because $this is a SiteTree Object and not my Page Class containing the GeoPoint Definition?
Any help appreciated. Maybe Ingo can put some light on this?
Cheers, wmk
-
Re: GIS Module Help

23 September 2010 at 9:19pm
I got it working so far - still quite untested but i'm happy i found a possible solution.
In Dataobject.php around line 2585 i replaced the foreach loop with this construct:
if($compositeFields) foreach($compositeFields as $k => $v) {
$dbO = $this->dbObject($k);
if($dbO) {
$dbO->addToQuery($query);
} else {
$tableClassObject = new $tableClass;
$dbO = $tableClassObject->dbObject($k);
if($dbO) {
$dbO->addToQuery($query);
}
}
}So addToQuery() is finally called.
Another bug was in GeoPointField.php::__construct(). The default value for $value was "" and should be null
class GeoPointField extends FormField {
public $xField, $yField;function __construct($name, $title = null, $value = null, $form = null) {
HTH anyone ;)
Cheers,
wmk
-
Re: GIS Module Help

24 September 2010 at 12:42pm
Wow, thanks for the replies guys! I'm going to be working on this code this arvo so will reply with stuff shortly.
| 1181 Views | ||
|
Page:
1
|
Go to Top |


