Firstly, thank you for making the OpenLayers 7.x-3.x beta version available. I'm going through and testing various features and I'm having trouble with a GeoJson feed I've created with views that I want to use as a Source.

If I have no contextual filters then the markers are all displayed correctly on my map, however once I add a contextual filter no markers display. In views, I've specified the Geojson path as 'countries/%' and when I preview the json, the correct data is shown.

When I add it as a source in the Openlayers UI, I've specified 'GeoJson' as the Source Type and added 'countries/%' to the URL field on the Source type options page. I've also tried the URL as 'countries' but neither works.

What should I be putting in the URL field?

Comments

pwhite’s picture

Having the same problem here, whatever I do it won't pas the contentual filter into the view.

In the view i've got the nid as the contentual filter, I then have the default value being set to 'Raw value from URL' with path component 2 (/node/[nid]).

I can only guess that the contextual filter is not being passed from OpenLayers into Views - any ideas?

ron_s’s picture

Version: 7.x-3.0-beta1 » 7.x-3.x-dev
Component: OL UI » OL Views
Category: Support request » Bug report

Is this a support request, feature request, or potentially a bug?

I create a Views GeoJSON feed in Views, and add a contextual filter of "Content: Nid" with settings of "Provide default value > Content ID from URL". I would think this is a fairly common situation -- I want to generate a simple map to display the address associated with a rendered node. The GeoJSON source preview generated by Views is correct.

However, when I view the Openlayers map on the node, there are no data points displayed. If I remove the contextual filter entirely, data points are shown as expected.

Are Views contextual filters not supported with Openlayers and Views GeoJSON? Or is it expected that some other method should be used if filtering data points based on URL?

ron_s’s picture

Component: OL Views » OL UI

FYI, when I create a Views GeoJSON feed, an Openlayers layer is automatically generated with a name of "views_geojson_<view_name>_<display_name>".

The URL that is saved in the Source type options includes a "%2A" to represent the wildcard "%" added to the path in Views. (For example, something like "http://mydomain.com/node/%2A/feed.geojson".)

I'm wondering if dynamic URLs are not supported, since this format does not seem correct to me.

mtbaileh’s picture

I face the same problem .I create a geojson view and passing the node id as contextual filter .in the data preview it works when i add the block of the map to my node page all the points are displayed.could any one tell me the right way to do this.