I'm trying to use Views' Custom Text field to add some WKT to nodes so they appear on the map, however, it seems OpenLayers doesn't consider this custom text appropriate for mapping...

Example:
I add the following to a custom text field in Views: POINT(100 -30)
I then output the view as an HTML list and it appears as follows:

* Thailand
  GeoNameID: 1609350
  POINT(100 -30)
* My first holiday!
  GeoNameID: 2171085
  POINT(100 -30)
* My first holiday!
  GeoNameID: 2143003
  POINT(100 -30)

If I then instead output the view as an OpenLayers map, setting the WKT data source to the custom text field, the map appears blank (i.e. no features displayed).

Any idea why this is?

Comments

phayes’s picture

Not sure - theoretically it should work.....

This might be helpful:

http://www.geomemes.com/node/78

How does textfields store stuff in the database? I would assume just as raw text - which *should* work. hmm

phayes’s picture

Another thing to watch is projection. You'll need to use a basemap that uses the 4326 projection, else you need to reproject your WKT values. However, even if you get your projection wrong, (for example using a google projection), those points should still show up somewhere close to 0,0 (off the coast of africa)

Anonymous’s picture

I attempted to change my projection to 4326 (previously using 900913) but when I saved there was no example map. Upon trying to change back to 900913, still no map. Something stuffed up...

Anonymous’s picture

This might be helpful:
http://www.geomemes.com/node/78

Yes, that's exactly what I'm trying to do, except that I'm using GeoNames to get lat/long values for each location and Views Custom Field's PHP field to do the dirty work within the view itself.

I thought it might be a problem with Views Custom Field at first, but then I tested the normal Custom Text field that comes with Views - same problem...

Anonymous’s picture

Just tested on a new site (since my other site was mucking up), but same issue - you can't use Custom Text fields for WKT.

phayes’s picture

I attempted to change my projection to 4326 (previously using 900913) but when I saved there was no example map. Upon trying to change back to 900913, still no map. Something stuffed up...

I ran into this issue yesterday. Definitely some sort of regression / bug. I'm gonna try to squash right now - as well as get all your patches committed. :-)

zzolo’s picture

As far as changing projections, the problem may be solved by this: #574028: Funky Behavior on merge maps - old layers stick around in UI.

As far as WKT fields, I have used these plenty, and have not had a problem. Can you output the view as just fields and it is valid WKT?

Anonymous’s picture

As far as WKT fields, I have used these plenty, and have not had a problem. Can you output the view as just fields and it is valid WKT?

Outputting the view as 'Unformatted' displays the fields properly (valid WKT). Were you using normal CCK fields, or the Custom Text field in Views?

Anonymous’s picture

Any update on this?

phayes’s picture

Status: Active » Closed (won't fix)

This is a bug in Views Custom Field: http://drupal.org/node/521190

I would suggest using the method detailed here http://www.geomemes.com/node/78 (using cck computed fields)