Please forgive me if I am posting this in the wrong place but I'm not sure whether it is a Geofield problem or an OpenLayers problem.
I ma trying to move over to using OpenLayers rather than the olde Google Maps way of doing things.

I am trying to make a simple map mashup of multiple Geofields using OpenLayers + Views.

I am using...
OpenLayers - 7.x-2.x-dev
Geofield - 7.x-1.x-dev
Views 7.x-3.x-dev

I have set up an content type called 'map_pin' and I have added a Geofield with it's input widget set to 'Openlayers Map' and it's Display format set to 'Openlayers Map'.

I have set up a node View with the Format to 'OpenLayers Map' with the 'Settings' to 'Geofield Formatter Map'.

I have two nodes that I know each individually display their map points on good-looking maps but when I pull these into the View, all I get is map with no points added.

Now, unless I have thoroughly misunderstood, I would have thought that somewhere along the line, I would have to tell Views precisely which fields to use for the map points but the 'OpenLayers Map' Format does not seem to be aware of the fields and says 'The selected style or row format does not utilize fields.'

Can anyone spare the time to tell me what I've got wrong here, or indeed to tell me how else I can go about grouping a number of Geofield map points onto a single map.

Many thanks.

Comments

phayes’s picture

Sure, what you want to do is create a view with the display type of "openlayers data" (in the same menu where you choose page, rss-feed, block etc), and then grab a geofield wkt field. This creates an views-powered openlayers layer than you can put on any of your openlayers preset maps.

I usually then just use panels to display this map with this layer... However, if you don't use panels (or need exposed filters) you can use the views "OpenLayers Map" display type instead.

giorgosk’s picture

I have installed
openlayers
geofield
geocode (probably not needed)

I have created node type (named customer) with input widget for Location field: openlayers map
I can succesfully input location points on openlayer google map and display it on node view

I can create view and display fields Location data (latitude/longitude only)

I can display all locations in a table and display openlayers default map (on OSM but not google map ?!)

I have followed your instructions above to create "openlayers data overlay" and it lets me map the appropriate fields to title/latitude/longitude/data/description

but

the "openlayers data overlay" does not have a URL path ? the preview only shows code ? what is the connections with the "page display" ?

How can I get all my locations on ONE google map ?

I would appreciate any pointers

giorgosk’s picture

Here is a dump of the display preview from "openlayers data overlay"

You can use the following parameters in your styles as dynamic values
------------
${title_rendered}
${title}
${field_location_rendered}
${field_location}
${field_location_1_rendered}
${field_location_1}
${body_rendered}
${body}
${field_location_2_rendered}
${field_location_2}
${name}
${description}

------------
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' => '4326',
    'attributes' => 
    array (
      'title_rendered' => '<a href="/en/another-customer">another customer</a>',
      'title' => 'another customer',
      'field_location_rendered' => '38.188',
      'field_location' => '38.188',
      'field_location_1_rendered' => '26.0284',
      'field_location_1' => '26.0284',
      'body_rendered' => '<p>another customer</p>',
      'body' => '<p>another customer</p>',
      'field_location_2_rendered' => '
    <div style="width: 600px; height: 400px;" id="openlayers-container-openlayers-map-02f4cb76" class="openlayers-container openlayers-container-map-geofield_formatter_map2">
      <div style="width: 600px; height: 400px;" id="openlayers-map-02f4cb76" class="openlayers-map openlayers-map-geofield_formatter_map2"></div>
    </div>',
      'field_location_2' => '
    <div style="width: 600px; height: 400px;" id="openlayers-container-openlayers-map-02f4cb76" class="openlayers-container openlayers-container-map-geofield_formatter_map2">
      <div style="width: 600px; height: 400px;" id="openlayers-map-02f4cb76" class="openlayers-map openlayers-map-geofield_formatter_map2"></div>
    </div>',
      'name' => '<a href="/en/another-customer">another customer</a>',
      'description' => '<p>another customer</p>',
    ),
    'wkt' => 'POINT(26.0284 38.188)',
  ),
  1 => 
  array (
    'projection' => '4326',
    'attributes' => 
    array (
      'title_rendered' => '<a href="/en/haus-fay-chios">Haus Fay Chios</a>',
      'title' => 'Haus Fay Chios',
      'field_location_rendered' => '38.1878',
      'field_location' => '38.1878',
      'field_location_1_rendered' => '26.0284',
      'field_location_1' => '26.0284',
      'body_rendered' => '<p>haus fay chios</p>',
      'body' => '<p>haus fay chios</p>',
      'field_location_2_rendered' => '
    <div style="width: 600px; height: 400px;" id="openlayers-container-openlayers-map-ed69c8d4" class="openlayers-container openlayers-container-map-geofield_formatter_map2">
      <div style="width: 600px; height: 400px;" id="openlayers-map-ed69c8d4" class="openlayers-map openlayers-map-geofield_formatter_map2"></div>
    </div>',
      'field_location_2' => '
    <div style="width: 600px; height: 400px;" id="openlayers-container-openlayers-map-ed69c8d4" class="openlayers-container openlayers-container-map-geofield_formatter_map2">
      <div style="width: 600px; height: 400px;" id="openlayers-map-ed69c8d4" class="openlayers-map openlayers-map-geofield_formatter_map2"></div>
    </div>',
      'name' => '<a href="/en/haus-fay-chios">Haus Fay Chios</a>',
      'description' => '<p>haus fay chios</p>',
    ),
    'wkt' => 'POINT(26.0284 38.1878)',
  ),
  2 => 
  array (
    'projection' => '4326',
    'attributes' => 
    array (
      'title_rendered' => '<a href="/en/teset-customerc">teset customerc</a>',
      'title' => 'teset customerc',
      'field_location_rendered' => '38.388',
      'field_location' => '38.388',
      'field_location_1_rendered' => '26.1248',
      'field_location_1' => '26.1248',
      'body_rendered' => '<p>customer</p>',
      'body' => '<p>customer</p>',
      'field_location_2_rendered' => '
    <div style="width: 600px; height: 400px;" id="openlayers-container-openlayers-map-87ebe336" class="openlayers-container openlayers-container-map-geofield_formatter_map2">
      <div style="width: 600px; height: 400px;" id="openlayers-map-87ebe336" class="openlayers-map openlayers-map-geofield_formatter_map2"></div>
    </div>',
      'field_location_2' => '
    <div style="width: 600px; height: 400px;" id="openlayers-container-openlayers-map-87ebe336" class="openlayers-container openlayers-container-map-geofield_formatter_map2">
      <div style="width: 600px; height: 400px;" id="openlayers-map-87ebe336" class="openlayers-map openlayers-map-geofield_formatter_map2"></div>
    </div>',
      'name' => '<a href="/en/teset-customerc">teset customerc</a>',
      'description' => '<p>customer</p>',
    ),
    'wkt' => 'POINT(26.1248 38.388)',
  ),
)
summit’s picture

Subscribing, greetings, Martijn

Brandonian’s picture

Status: Active » Closed (fixed)

Closing. @GiorgosK, if you still need any help with creating the Openlayers display, there's pretty good documentation on their module page. Re-open if you need any specific help.