hi,

i want to put custom field value as externalgraphic path

${field_term_image} output: 'http://localhost/auto/sites/default/files/uploads/terms/directory/gazsta...',

but in map is printed as:

<image id="OpenLayers.Geometry.Point_54" cx="389.9928530314937" cy="155.7978231292218" r="1" x="385" y="151" width="10" height="10" href="http://localhost/auto/%24%7Bfield_term_image%7D" style="opacity: 1" fill="#FFCC66" fill-opacity="0.5" stroke="#FF9933" stroke-opacity="1" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="none" cursor="pointer"/>

why?

Comments

Not entirely sure how you set it up, but you may have to use the rendered version, and ensure you are using the URL formatter (assuming this is an imagefield).

Hi! zzolo!

look, i'm using image_url_formatter module to output image field as path, so, in my view i have:

${title_rendered}
${title}
${latitude_rendered}
${latitude}
${longitude_rendered}
${longitude}
${field_term_image_rendered}
${field_term_image}
${name}

where

'field_term_image_rendered' => 'http://localhost/auto/sites/default/files/uploads/terms/directory/gazsta...'.

now, i want to use this value in /admin/structure/openlayers/styles/default/edit "externalGraphic" field. so i put ${field_term_image} as value in it.

but after save, and open my map, the external graphic path is rendered as:

so u can see, the path to the image is broken.

P.D. sorry for my english

Have you updated to latest version of 7.x-2.x?

yes, last dev version from yesterday.

Status:Active» Fixed

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Title:Use ${field_term_image} in externalGraphic Using ${field_term_image} in externalGraphic gives invalid image URL
Category:support» bug
Status:Closed (fixed)» Active

Hi,

I think I'm having the same problem. I have a taxonomy term with an image field. I set up the view appropriately, and the preview gives the token ${field_service_type_marker} which evaluates to the full path to the image. I try to use this in a custom style as the externalGraphic, and on the map the actual path used has the hostname doubled up (eg. http://example.com/http://example.com/sites/default/files/marker.png). The problem seems to originate in openlayers_render_style() where I think it tries to ensure there's a full path before doing the token substitution (resulting in http://example.com/${field_service_type_marker}. I'm new to OpenLayers, so could easily have missed something (I'm surprised nobody else seems to be whining!).

I've checked this both on the latest beta and latest from git.

TIA

Category:bug» support

Hi @AndyF, are you still having this issue. I am not really sure what the issue is, we are just passing that value to file_create_url()

Do note that the fix described above is only in the dev version (7.x-2.x).

I needed to use strategy.cluster so I ended up using a bit of JS to pass a context function for the parametrised values, effectively overriding the OpenLayers style settings, so I'm not seeing it as an issue anymore. But apparently I did check against the latest (I can't actually remember specifically now!). IIRC $style as passed to openlayers_render_style() hasn't had the token substitutions done. So if you try the following as a drush script:

module_load_include('inc', 'openlayers', 'includes/openlayers.render');
$style = array('externalGraphic' => '${field_service_type_marker}');
print_r(openlayers_render_style($style));

It shows externalGraphic as http://default/${field_service_type_marker} (just tested with 2.0-beta1). The problem is that $field_service_type_marker} is an absolute path itself, so that's where I think the double-up comes from. The way I got around it (before realising that clustering would screw everything up anyway!) was to use a computed field that returned the Drupal path (rather than absolute).

Status:Active» Fixed

Hey @AndyF. This should fix it: http://drupalcode.org/project/openlayers.git/commit/2fe8a72

Basically the issue was that if the value was just ${value} then the Drupal url function would assume it was a relative path and then just stick the base path on it. But, if it is solely that sort of value, then we should just pass it through to OpenLayers.

I also added some more tests for this.

Great stuff, thanks!

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Title:Using ${field_term_image} in externalGraphic gives invalid image URLGet and Change ${count} value

in my view i have:
${count}
${name}
${field_location_rendered}
${field_location}
${title_rendered}
${title}
${#row_rendered}
${description}
I want to get value of ${count} and perform some calculations on it and again save ${count} in it. But cant sort out how it can b done. help needed.

Status:Closed (fixed)» Active

in my view i have:
${count}
${name}
${field_location_rendered}
${field_location}
${title_rendered}
${title}
${#row_rendered}
${description}
I want to get value of ${count} and perform some calculations on it and again save ${count} in it. But cant sort out how it can b done. help needed.

Title:Get and Change ${count} valueUsing ${field_term_image} in externalGraphic gives invalid image URL
Category:support» bug
Status:Active» Closed (fixed)

@Mujtaba Ahmed I think that should be a new support request.

In Views trying to change marker styles..

I have a field: ${field_allowed} which returns: "Y"
But I need it to return "Y.png" so externalGraphic will return website.com/Y.png as the marker style.
So I re-write the result.
Now ${field_allowed_rentered} returns: "Y.png" and ${field_allowed} returns "Y".
But externalGraphic still only returns "Y".

How can I set externalGraphic to return the field_allowed_rendered version? All the style setting allows me to select is field_allowed.

I'm using the latest development version and I don't know if the bug has crept in again but I'm having the same problem.

In my custom marker style, I have set externalGraphic to this: sites/default/markers/${field_resource_type_rendered}.png

When I view the map, the marker image is broken and inspecting the element shows the following:

<image id="OpenLayers.Geometry.Point_78" cx="2871.4586186460515" cy="-1820.367046610685" r="1" x="2865" y="-1826" width="12" height="12" xlink:href="http://mapping.localhost/Marina" style="opacity: 0.4" fill="#ee9900" fill-opacity="0.4" stroke="#ee9900" stroke-opacity="1" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="none" pointer-events="visiblePainted" cursor="inherit"></image>

In my View, the openlayers data is showing the following output:

You can use the following parameters in your styles as dynamic values
------------
${title_rendered}
${title}
${field_geofield_rendered}
${field_geofield}
${field_resource_type_rendered}
${field_resource_type}
${name}
------------
The following is a dump of the data that is rendered from this display. It is used for debugging purposes only.
        array (
  0 =>
  array (
    'projection' => 'EPSG:4326',
    'attributes' =>
    array (
      'title_rendered' => '<a href="/resource/marina/south-island-marina">South Island Marina</a>',
      'title' => 'South Island Marina',
      'field_geofield_rendered' => 'POINT (-0.0314657 51.6413752)',
      'field_geofield' => 'POINT (-0.0314657 51.6413752)',
      'field_resource_type_rendered' => 'Marina.png',
      'field_resource_type' => 'Marina',
      'name' => '<a href="/resource/marina/south-island-marina">South Island Marina</a>',
    ),
    'style' =>
    array (
      'externalGraphic' => 'http://mapping.localhost/Marina',
    ),
    'wkt' => 'POINT (-0.0314657 51.6413752)',
  ),
  1 =>
  array (
    'projection' => 'EPSG:4326',
    'attributes' =>
    array (
      'title_rendered' => '<a href="/resource/launderette/southbury-launderette">Southbury Launderette</a>',
      'title' => 'Southbury Launderette',
      'field_geofield_rendered' => 'POINT (-0.0508114 51.6486967)',
      'field_geofield' => 'POINT (-0.0508114 51.6486967)',
      'field_resource_type_rendered' => 'Launderette.png',
      'field_resource_type' => 'Launderette',
      'name' => '<a href="/resource/launderette/southbury-launderette">Southbury Launderette</a>',
    ),
    'style' =>
    array (
      'externalGraphic' => 'http://mapping.localhost/Launderette',
    ),
    'wkt' => 'POINT (-0.0508114 51.6486967)',
  ),
  2 =>
  array (
    'projection' => 'EPSG:4326',
    'attributes' =>
    array (
      'title_rendered' => '<a href="/resource/launderette/valley-wash-tub">The Valley Wash Tub</a>',
      'title' => 'The Valley Wash Tub',
      'field_geofield_rendered' => 'POINT (-0.0391696 51.6432706)',
      'field_geofield' => 'POINT (-0.0391696 51.6432706)',
      'field_resource_type_rendered' => 'Launderette.png',
      'field_resource_type' => 'Launderette',
      'name' => '<a href="/resource/launderette/valley-wash-tub">The Valley Wash Tub</a>',
    ),
    'style' =>
    array (
      'externalGraphic' => 'http://mapping.localhost/Launderette',
    ),
    'wkt' => 'POINT (-0.0391696 51.6432706)',
  ),
  3 =>
  array (
    'projection' => 'EPSG:4326',
    'attributes' =>
    array (
      'title_rendered' => '<a href="/resource/launderette/wash-shop">The Wash Shop</a>',
      'title' => 'The Wash Shop',
      'field_geofield_rendered' => 'POINT (-0.047058 51.6421178)',
      'field_geofield' => 'POINT (-0.047058 51.6421178)',
      'field_resource_type_rendered' => 'Launderette.png',
      'field_resource_type' => 'Launderette',
      'name' => '<a href="/resource/launderette/wash-shop">The Wash Shop</a>',
    ),
    'style' =>
    array (
      'externalGraphic' => 'http://mapping.localhost/Launderette',
    ),
    'wkt' => 'POINT (-0.047058 51.6421178)',
  ),
)

For some reason the externalData value in the openlayers data appears to be the value used rather than the value set in the style.

Any ideas?

Thanks!