When you search for an adress with the Geocoder and then select one of the adresses returnd by the autocomplete no Geometry is beeing added into the WKT textfield of OpenLayers Module.

Reason for this is, that the Javascript function Drupal.Geocoder.process was adding the feature onto the first vector layer of the Map. The new dev version of the OpenLayers Module adds the features to the last vector layer.

This can easily be fixed. I've provided a patch file. See line 69.

Greetings,

Ondrej

Comments

ademarco’s picture

Could you attach the patch you are talking about? Thanks a lot!

hefox’s picture

Subscribe; as they said, your patch file isn't attached! :(

asb’s picture

Similar issue here.

Example procedure (please try to reproduce): On the node editing form, do an address search for "Kenia". The Google webservice responds with one record: "Kenia", and the OpenStreetMap map is adjusted to show a marker at the South Pole (yeah!). The geodata field remains empy. On the saved node a world map without any markers is displayed. Pretty strange behaviour... ;)

Modules used:

  • Geo 6.x-1.0-alpha5
  • OpenLayers 6.x-2.0-alpha4
  • OpenLayers Geocoder 6.x-2.0-alpha2

The CCK field type I'm using is "Geospatial data". It's exactly the same behaviour if I'm using the field type "OpenLayers WKT".

Edit: Upgraded to openlayers 6.x-2.x-dev, still exactly the same behaviour.

Thanks & greetings, -asb

ademarco’s picture

Could you try to also upgrade Openlayers Geocoder to 6.x-2.x-dev? It should be fixed there...

asb’s picture

Yeah, lets go bleeding edge ;) Now running openlayers_geocoder 6.x-2.x-dev 2010-Apr-26. Still exactly the same behaviour.

Probably I'm missing something; currently I'm using the field type "OpenLayers WKT" with the input widget "OpenLayers Geocoder". Other field settings:

  • Input Map Preset: Geotaxonomy Map
  • Autocompletion: Text field "ISO Country Code" matched to the token [country_code]
  • Default value: (empty)
  • Global settings: Required: (unchecked); Number of values: "1"; Feature Types: Point, Path, Polygon (all checked)

Anything else I can check?

Update: After clearing all caches (through 'admin_menu', the behaviour changed a little bit: On the node editing form, do an address search for "Libyien" (= Libya). The Google webservice responds with one record: "Libyen", and the OpenStreetMap map is correctly positioned to show a marker at Libya (that one in north Afrika - yippie!). The geodata field remains empy, the ISO Country Code field is correctly populated. On the saved node a world map without any markers is displayed. This now works similar with "Kenia". Still strange behaviour... ;)

Thanks & greetings, -asb

kostajh’s picture

I am having the same problem described in #3. Using latest dev release (as of 4/29/10) of OpenLayers and OpenLayers Geocoder.

ademarco’s picture

Status: Patch (to be ported) » Active

I really cannot replicate using the latest snapshots of both modules. Could you guys give me more information about your settings or, if possible, could you attach an export of your configuration (layers and presets)? Thanks!

ademarco’s picture

Ok, I managed to replicate. The problem is when there are more then one vector layer on a preset used for input. I'll work on it as soon as possible.

ademarco’s picture

Status: Active » Fixed

Fixed and committed to HEAD: http://drupal.org/cvs?commit=361476

asb’s picture

Upgraded to the latest openlayers_geocoder 6.x-2.x-dev 2010-Apr-30 which should contain the fix (or was it commit time plus 10 hrs?)

Behaviour so far still unchanged in comparison to the last dev release from 26th of April (#5). I'll re-check in a few hours if a new dev release pops up.

ademarco’s picture

If you don't want to wait for the packaging script try with a CVS checkout: http://drupal.org/node/638988/cvs-instructions/DRUPAL-6--2

hefox’s picture

It works for me!

Latest dev of both; there's an error on the configuration page, but that is likely unrelated (probably an error in dev of openlayers, I'll check it out later warning: Invalid argument supplied for foreach() in /volumes/crwdev-ebs1/www/hfs/bell/drupal/sites/all/modules/contrib/openlayers/includes/openlayers.render.inc on line 23.)

asb’s picture

Ok, upgrades installed; indeed this is working much better now: Searching for "Japan" fills the WKT test area ("GEOMETRYCOLLECTION(POINT(138.252924 36.204824))"), and some tokens are correctly extracted. Great!

However, when accessing any node with an OpenLayers map on it, I'm getting a JavaScript popup saying: "with map.options" (nothing else).

Maybe just another issue (searching...) Edit: Seems to have to do nothing with 'OpenLayers Geocoder' - it still pops up when the geocoder is disabled.

Thanks for the fix & greetings, -asb

ademarco’s picture

Status: Fixed » Closed (fixed)
asb’s picture

Seems to be broken again after fixing the issue mentioned in #13: #787294: JavaScript popup saying: "with map.options"

asb’s picture

Status: Closed (fixed) » Active

Re-checked all settings, reset all OpenLayers presets and styles, still broken.

Re-opening, sorry!

Edit: This seems to be a bit erratic; on some nodes it works, on othes it doesen't. Still testing to find apattern.

ademarco’s picture

Status: Active » Postponed (maintainer needs more info)
pribeh’s picture

subscribing.

steinmb’s picture

Have not seen this error in the latest dev. snapshots
@asb: Any news from your testing?

asb’s picture

@steinmb:

Last time I checked the behaviour was still there, appearing erratic (as reported in #16). I tried to reproduce it on another site and ran into additional issues and finally gave up in trying to keep this working. I haven't touched geocoding for several weeks and disabled the module, but not yet uninstalled.

OpenLayers Geocoder is well-thought and and user-friendly, in short: extremely cool, but it's basics - OpenLayers - are currently imho the total opposite (intransparent, user-unfriendly, inconsistent). However, if time permits I'll give it another try.

itserich’s picture

This may be related: http://drupal.org/node/919162

ademarco’s picture

Could some of you guys check it again with the latest dev version of both modules? Since #919162: WKT Field does not update if "Search address" originally not populated is for sure not related with this one there are good chances that the problem is now fixed (I still don't have it). Thanks!

ckng’s picture

[-deleted-]
not a similar problem, wrong settings.

ademarco’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Closing since I really cannot reproduce: the problem seems to not be there anymore.

jason.lally@gmail.com’s picture

Status: Closed (fixed) » Active

This has been closed for a while now, but I seem to be having the same problem. I am running two sites and on one site it works and on another it does not. I have the exact same versions of openlayers and openlayers geocoder installed on each site. What I noticed that differs is the following:

On the working site, the geocoder calls the following through ajax:
http://placematters.org/openlayers/geocoder/response/denver

And returns the following JSON:
{ "Denver, CO, USA": "\x3cspan class=\"openlayers-geocoder-result detail-row-1\"\x3eDenver, CO, USA\x3c/span\x3e\n\x3cspan class=\"openlayers-geocoder-result detail-row-2\"\x3e Denver - United States\x3c/span\x3e" }

On the non-working site, the url is formed this way:
http://staging.nrvlivability.org/autocomplete_element/js?path=openlayers...

And returns the same JSON.

The most important difference between the two is that the response process that runs fine on the working site calling:
http://placematters.org/openlayers/geocoder/response/process
And returning:
{ "latitude": 39.7391536, "longitude": -104.9847034, "box": { "north": 39.8762981, "east": -104.7285846, "south": 39.6017356, "west": -105.2408222 }, "fields": { "field_street": { "value": " ", "name": "field_street", "override": 0, "type": "input" }, "field_city": { "value": "Denver", "name": "field_city", "override": 0, "type": "input" }, "field_state": { "value": "Colorado", "name": "field_state", "override": 0, "type": "input" }, "field_zip": { "value": "", "name": "field_zip", "override": 0, "type": "input" } }, "keep_points": 0 }

When I select a result on the non-working site, nothing is called or processed and the WKT field never gets populated.

I can't seem to trace where this is happening, but it seems like a piece of Javascript isn't getting loaded. Any insights?

Jason

jason.lally@gmail.com’s picture

I figured out the issue. This is only a problem when Autocomplete Element is enabled. I didn't need that module so I just disabled it, but it may be worth something looking into. I'm not sure where the problem happens, but autocomplete element uses a different autcomplete plugin that is more configurable than core.

I have created a new issue at: #1224746: Autocomplete Element module breaks geocoder

jason.lally@gmail.com’s picture

Status: Active » Closed (duplicate)

Closing