Update 5/31/2016

Note: if you are experiencing this issue and you have an Openlayers Views source, please see this more specific issue: #2737671: Automatic Source created from OL View does not create functional Source.

In the meantime, you can also consider using Views GeoJSON instead of Openlayers Views. See comment #43 below for more information, and more explanation about how to fix this error in general.

Original description:

It turns out that the Openlayers 3.x demo site has the same error, "Unable to load CTools exportable source" :-)
http://dev.through-my-eyes.be/

Choose "Map with block layer switcher" for example.

See the screenshots...

Comments

Max1’s picture

Comment: I think it is official developer's demo site because link to that site taken from group https://groups.drupal.org/node/440733 , which is posted on OpenLayer projects's frontpage: https://www.drupal.org/project/openlayers

m.stenta’s picture

Priority: Normal » Major

I'm getting this error when I create a new custom map. Along with another error when I go to the Map Settings page: "Service doesn't exists, unable to load Normal test_map"

Changing this to Major because creating maps is broken.

m.stenta’s picture

Hmm... I think I figured out what's causing this. If you create a new map and click "Save and edit" instead of "Continue" in the first step, you're left with a malformed map.

pol’s picture

Status: Active » Fixed

Hi,

Thanks for the bug report.

You might want to test the dev version, this commit might fix the problem.

Reopen the issue if not.

m.stenta’s picture

Thanks @Pol! I will test that. But the commit looks good!

myDrupal2014_846824658246’s picture

I confirm behavior mention in #2.

d_f’s picture

I get this error whenever I enable either openlayers_block or openlayers_block_switcher modules. Using 7.x-3.x-dev or 7.x-3.0-beta1, both versions of these two modules give me the same errors when enabling them.

pol’s picture

@das-peter just committed a fix that might fix that, could you use the dev version and see if you still have the same problem ?

Thanks.

Max1’s picture

By the way, on that demo site dev.through-my-eyes.be all looks good now. Thanks!

robertwb’s picture

Confirmed that I am experiencing this error using the latest dev version obtained from git on 4/21/2015. Clearing caches fixes this temporarily, but the error resurfaces some 10-15 minutes later. In my case the error refers to a source of type "views_geojson".

robertwb’s picture

Status: Fixed » Active
d_f’s picture

@pol I have since reverted to a more pristine version of the server vm, and installed newest open layers & dependencies with drush. I only got two errors:

Service openlayers.component.internal.BlockLayerSwitcher doesn't exists, unable to load Default openlayers_examples_component_blocklayerswitcher
Service openlayers.component.internal.Geolocation doesn't exists, unable to load Default openlayers_examples_component_geolocation

After that, I ran cron, and all seems fine at the moment. This seems to be some kind of conflict with another module or setting, but I'm short in time atm to figure out which one it was in the vm I had. I will be taking a features based approach with this.

When I have more time I will be going back to this one to see why it happens in my case.

/sidenote: I'll be opening a thread on how to get the google maps satellite & hybrid tiles in V3, as these are perfectly working in a V2 I have installed elsewhere, but can't seem to find them anywhere, neither a how to on activating them in this newest version.

Countzero’s picture

I think I have this problem too with Views. The error reads : "Unable to load CTools exportable Map viewmapname"

The server OL is running on has PHP 5.3 and upgrading is not a realistic option, and as OL dev requires 5.5, There's no way out.

Is there any way to circumvent this bug without upgrading to OL dev ?

Countzero’s picture

Tested with latest dev and the error shows up when creating a View of type 'Openlayers View Map'.

BTW, instructions here https://www.drupal.org/node/1481374 don't seem to fit with dev version.

Any particular change to pay attention to when using OL 3.x compared to 2.x ?

m.stenta’s picture

@Countzero: I noticed the same problem when using Openlayers Views. Clearing the cache fixes the issue.

It seems that Openlayers Views is automatically creating a Map when you create a display, and linking them in the background. However, when you initially save the view, it does not create the map until the next cache clear.

I have also been seeing this issue when you add sources/layers/etc to a map, and then delete the source/layer/etc. The map is still looking for it, but since it doesn't exist, this error shows in the UI.

Countzero’s picture

Yes clearing caches solves the issue, but for some time only.

In my case, it turned out I messed up versions 2 and 3. Installing 2.x dev cleanly seems to do the trick.

FWIW, 3.x doesn't seem to be ready at all, but so many things seem to have changed that I may have misunderstood the way to use it. Some intructions to test it properly could be useful.

Thanks anyway.

milos.kroulik’s picture

I have also been seeing this issue when you add sources/layers/etc to a map, and then delete the source/layer/etc. The map is still looking for it, but since it doesn't exist, this error shows in the UI.

Isn't this a good reason to feature request? It would be nice, if there was some sort of alert, that there are dependent objects, that can be broken after delete.

mariotaz58’s picture

Hie guys,
I'm trying to follow that video tutorial https://www.youtube.com/watch?v=M3UKj4YxvTE to get openlayers3 running on my site.

Most of the overlays schowned on that video are old comparatively to the recent implementation of openlayer.

I'm stuck at step 14min45sec.

I have had the issue "Unable to load CTools exportable source" while adding a page in my view which is, by the way, showing in this preview the textual information of the geodesique points I want to see on a map, on my front page.

That issue appeared, in a red box, at the top of the preview section in the overlay of the view.
It also appears at the front page after a "flush all cash".

That issue has dissapeared after a modification of permission on node (espacelly about map I'm creating); services ; Contextual links;
nevertheless I don't have the rendering of a map in my preview. I just have icone +/- for the zoom. That's it. but no issue "unable...ctools..." is schowned.

On the other hand, and because I don't succed to achieve the video tutorial earlier mentioned, I tried to use a simple block to render a map and some markers on it.
And then the issue came back, on the front, with more details as I get a back-trace by using devel.

I'm facing that issue too, when playing with view or block to get a map on a preview either on front.

here after what I've discovered:

Using devel i caught a back trace that mentioned
"Fatal error: Call to undefined function ctools_export_crud_load_all() in your_url\sites\all\modules\contrib\openlayers\modules\openlayers_block\openlayers_block.module on line 63", which a call to a function which is undefined, because it doesn't exist a such function.

The caller is _openlayers_block_get_map_name($delta) located your_url\sites\all\modules\contrib\openlayers\modules\openlayers_block\openlayers_block.module and it calls the function with one parameter while the signature of a function contains 2 parameters.
caller = $all_maps = ctools_export_crud_load_all('openlayers_maps');
called = function ctools_export_crud_load_all($table, $reset = FALSE){//code

What do you think about thies?
regards

strainyy’s picture

I'm also having this issue. "Unable to load CTools exportable "

briward’s picture

I'm also having the same problem.

Unable to load CTools exportable Map map_views_centres_page_1.

rhodhellie’s picture

Hi I solve my problem by deleting the the missing map view.

Example:

Unable to load CTools exportable Map map_views_centres_page_1.

Under Structure>Openlayers>Maps

Delete the existing map_views_centres_page_1.

Hope this one help.

strainyy’s picture

@rhodhellie what if you wanted to keep your map?

swiftarf’s picture

I'm having the same problem when creating a view. I also get

Drupal\Component\Plugin\Exception\PluginException: Plugin (Views) instance class "Drupal\openlayers_views\Plugins\Map\Views\Views" does not exist. in Drupal\service_container\Plugin\ContainerAwarePluginManager::getPluginClass() (line 120 of /sites/all/modules/service_container/src/Plugin/ContainerAwarePluginManager.php).

When I try to view the page created by the view. It is not possible to see any map previews either.

Any help would be gratefully received.
Thanks

santhoshabraham’s picture

StatusFileSize
new65.94 KB

I'm getting this error also.. Any solution out there ?
 Ctools-exportable map error.JPG

Ardit Meti’s picture

+1 same issue, following

fubarhouse’s picture

+1. Following.

  • Pol committed d45f165 on 7.x-3.x
    Fix #2455929: Fix Openlayers Views Map style plugin in Views.
    
pol’s picture

Hello all,

I rewrote the Views plugins this afternoon and you are now able to use Views with Openlayers, just like you used to in 2.x... with a slight difference.

First, the preview is working.
Second, as we are unable to provide a complete map settings form in Views, I've added an option 'Base map'. It let you choose the map to use for creating the new map. So, a view map will be an existing map + the new features layer.

See the screenshots.

Screenshot 1
Screenshot 2

pol’s picture

Status: Active » Fixed
Nkendall’s picture

I'm having this problem now.

hockey2112’s picture

I am also having this issue on 7.x-3.1

Nkendall’s picture

Status: Fixed » Active

Still happening on 7x-3.1, I get the error both in the OL admin UI and trying to add custom markers. Maybe related to Ctools Style issue. Here's a screen shot: Unable to load Ctools component error.

Also, happens with my own maps, but not with any of the example maps.

Syntapse’s picture

subscribing

pol’s picture

Dear laurence,

There is a 'follow' button on the sidebar right of each issue, there's no need to write these comments anymore and notify all the people for nothing.

stopopol’s picture

Hi everyone,

I got rid of that error message "Unable to load CTools exportable control". The culprit was - as indicated by my error message - a control.
I only had to configure my map, which was the Openlayers Geofield: Widget map, and turn off the Openlayers examples: Control OL3 LayerSwitcher.

That's it. It was tough to find the root of the problem though.
Hope this helps someone else too.

Gerhard Roth’s picture

What Pol told about the new dev version sounds great

What drupal openlayers would make a great project for thousands of organisations would be
- to put their sites, events, locations on a map without programming just by entering drupal nodes
- giving all different types of locations an indivdual style (different layers)
- putting all the layers on one map as a drupal page
For me thats the promise of Drupal Openlayers

In reality I spent a lot of hours to bring that to work
- following instructions like the one of mariotaz58 meant for OL 2
- running into the above error
- having none of the locations on the map
until finding this post

I installed the dev version yesterday but finding the same dialogs in the views plugin as in 3.1 (different than the screenshots of Pol) and the same error. I am nearby to give up. Is it my fault?

joelhsmith’s picture

@Gerhard Roth Its not just you. I have been trying to fix this for 30 hours. I am beyond disparate. Is there anyone on this thread who has a working version of Openlayers 3 Views component without the error? If you have a recipe or a patch that works I will pay you money. Paypal whatever.

robertwb’s picture

FWIW @joelhsmith - when I looked at this earlier, there seemed to be no stable install path that did not include drush - so much so at the time that is might even be considered as an install requirement. That may have changed, as at least some folks are able to get it up and running but it may be worth a shot.

joelhsmith’s picture

@robertwb Are you aware of a tutorial using Drush that can help with the proper steps? I'm all about Drush! That's no problem. I have searched the web and the official documentation for days.

btw - Everything other than the Views issue is working perfectly (Sincere thanks for your hard work maintainers).

m.stenta’s picture

Hi everyone, this is a pretty simple error message at it's heart: one of your Openlayers objects (maps, layers, sources, etc) is referencing another object that doesn't exist. The error itself is actually from CTools, and is relatively general... Openlayers just uses Ctools A LOT, and it's easy to cause the issue to happen accidentally, so that's why this thread is so popular. :-)

This could have happened for a number of reasons, but I would like to divide them into two right now: "bug in code" vs "messy configuration".

"Messy configuration" implies that something got messy during your object building process. For example: create a new custom control, create a new map and add the control to the map, then delete the control - you will see this error message because the map is still looking for the deleted control.

Another common way this might happen: enable the Openlayers Examples module, create your custom map and use something from the Examples module, uninstall the Examples module... the things you used from the Examples module will be referenced in the map, but will no longer be available, hence the CTools warning.

"Bug in the code" would be something that needs to be fixed in Openlayers itself. Maybe that is true, but so far a lot of the comments I've read above indicate "messy configuration" is the issue, and many folks have figured it out on their own by understanding that.

Recently there have been some mentions of this issue with regards to the Openlayers Views module. Maybe there is specifically a bug with the way that module works, which causes messy configuration to happen automatically? That's possible - and maybe we should create a new issue to explore that specifically. I haven't worked with the Openlayers Views module much myself, so I haven't run across it.

Would someone like to take a stab at writing a "steps to reproduce" specifically for the Openlayers Views module? Either in this thread or a new one would be fine... we can decide if it warrants breaking it out to it's own issue.

joelhsmith’s picture

@m.stenta Thank you for your reply. Your note about "messy configuration" is very helpful. The vagueness of the CTools error message leads (perhaps mis-leads) us to believe there is a problem with the module, due to the message's lack of specificity. None of us (me included) is beyond messing up somewhere in our configuration. It is a very powerful module, with many options, that could lead to a problem.

I understand that a "steps to reproduce" is required to continue to narrow down the "messy configuration" vs "bug". This could take many hours. I will give it a shot. Perhaps I can provide a Feature of my entire configuration.

Thank you everyone for your replies! My heart swells with appreciation for you all.

m.stenta’s picture

Thanks @joelhsmith! That'll be really helpful!

I agree that the vague error is pretty much useless for debugging. "Hey something's wrong! Go figure it out for yourself!" Haha

Maybe we could add a bit of our own logic within the Openlayers module that detects the same thing, but provides a more useful message. ie: "Hey your map FOO is referencing control BAR, but control BAR doesn't exist. Go and fix your map FOO configuration by loading the map controls form and click save"

Might also be possible to automate the cleanup process... but I'm a little more wary of a heavy-handed approach like that, which would involved editing your configurations behind the scenes. Not a fan of that myself. I would rather understand the issue and fix it myself.

joelhsmith’s picture

PART 1:

@m.stenta, your simple advice that "Unable to load CTools exportable source" CTools error message does not indicate where the real issue is coming from. There is not enough information to blame the module.

For those who find this thread in the future, go thru the steps below first. They are a prerequisite to start debugging Openlayers Views. You need to figure out if you have an issue with the Views part vs Maps, Layers, Sources... checking this is very simple, but tedious.

Go thru every "Source" edit then save on all the sections "Administrative settings" then save. "Sources type" save! "Source type options" save! Next, do that to ALL your "Layers" on every step... "Administrative settings" save! "Layer type" save! "Layer style" save! "Layer type options" save! Then your "Maps" section in the same way. Save, save, save. If a source is messed up. You map will not work. Simple as that.

The reason I say to go to every screen and save is because I don't know when the module is validating each Source, Layer, and Map. I found it catch two error messages as I went along, I resolved those. That will allow you to debug all those issues before you start in on the Maps area. After you have every one of the Sources, Layers, and Maps saved error free, you can move on.

I do not get the "Unable to load CTools exportable source" error anymore.

PART 2:

Sorry I'm not done. Even after I removed the "messy configuration" the Views component still does not work :-)

One of the many cool features that the module provides is automatically creating "Sources" from Views. When you make a new View:
-Enter View name in text box
-Show "Content" of type "Your Content Type"
-Uncheck "Create a page".
-Click "Continue & Edit" button
-Click "Add" to add your Location Field (or whatever you called it)
-Add a Display. Click "Add" button > Choose "Openlayers data".
-For Format choose "Openlayers source".
-Map Data Sources is probably going to WKT for you
-Choose your Location Field for WKT. (if it is not there you forgot to add it as a field earlier, lol, go back and do that dude).
-Click "Apply (all displays)".
-Scroll down and look at your Preview. Its our data that will be used as the Source. You should see data on your nodes in there. (If you only see ten of them change your Pager settings bro.)

NOW let's look at the Openlayers Sources! You will see @Pol's awesome automagicical Source creation.

-Go to Openlayers Sources tab /admin/structure/openlayers/sources and you will see a magic Source appear. It will probably be a openlayers.Source:Vector service
-Find the new magic Source the maintainers made us. Nice!

Now go to Openlayers > Layers tab. You will need to add a new Layer to consume your Source.
-Click "+ Add".
-Name it, Save it.
-Go to "Layer type" link choose "Vector".
-Under "Source" select your new magic Source from earlier.
-Click "Save & Edit" button.

Now go to Openlayers > Maps tab to add the new layer to a map.
-Find you map
-Click "Edit"
-Click the "Layers" link near the top.
-Enable your new Layer. Its probably a openlayers.Layer:Vector service. Drag it to the bottom of your enabled layers so it will show up on top.
-Click "Save & Edit" button.
-Click the "Components" link near the top.
-Enable "Openlayers: Block Layer Switcher"
-Click "Save & Edit" button
-Click "Preview" link near the top.

All my other Tile based layers are working great. But that new Layer is not functioning. I was expecting the data that that was shown in the View we made earlier. The checkbox for the Layer is in the list. But it shows no data.

-Expand your "Layer Switcher"
-Click around on your layers to double check that it is not there, or just hidden under something


I have tried to provide details on how I replicate my problem. Since I can't find any errors, I don't know what to try next. Any advice?

Should I continue to debug this? Or are there other options to get generate data from these nodes to make a new Openlayers Source the could be consumed by a Layer in Openlayers?

Although the instructions above are correct (as far as I can see), don't bother using that automatic Source creation. It is cool, but it is not necessary to use Openlayers and that Source will not work. But the following work around does.

Part 3:

Create a Source yourself. I made a new View using "geofield_map" module instead (not part of OpenLayers suite). Its easy.

-Install the geofield_map module
-Enter View name in text box
-Show "Content" of type "Your Content Type"
-Uncheck "Create a page".
-Click "Continue & Edit" button
-Under "Fields" Click "Add" to add your Location Field (or whatever you called it)
-Add a Display. Click "Add" button > Choose "Feed".
-For Format choose "GeJSON Feed".
-For its settings Map Data Sources is probably going to WKT for you
-Choose your Location Field for WKT. (if it is not there you forgot to add it as a field earlier, lol, go back and do that dude).
-Under the "Feed settings" fieldset in the middle of your screen add a "Path" make it good, like "/yourcontenttype-source-geojson".
-Keep the rest of the defaults.
-Scroll down and look at your Preview, you will see some GeoJSON from your Nodes.
-Click "Apply (all displays)".

Now, we go back to Openlayers and make our new Source manually.

-Go to Openlayers click the Sources tab.
-Click the "+Add" link.
-Give it a Title like "Yourcontenttype Source WKT" and leave the defaults.
-Click the "Save & Edit" button.
-Now you are on the "Source type" area. For "Source Type" choose GeoJSON.
-Click the "Save & Edit" button.
-Now we are on the "Source type options" area. You need to enter a URL. Go back to your View and copy that path. I called it "/yourcontenttype-source-geojson".
-If you are like me you are working on a local dev server. Copy the first part of your URL from the address bar and create your URL. It might be something like "http://supercoolmap.sandbox:8888/yourcontenttype-source-geojson"
-Keep the rest of the defaults.
-Click the "Save & Edit" button.

Nice job buddy! You have a Source. Now we make a Layer to consume your Source.

Part 4:

Now go to Openlayers > Layers tab. You will need to add a new Layer to consume your Source.
-Click "+ Add".
-Name it, Add a good description like "From views_geojson View I made"
-Click "Save & Edit" button.
-Go to "Layer type" link choose "Vector".
-Under "Source" select the source we just made "Yourcontenttype Source WKT", or whatever you called it.
-Leave the "Layer style" ad "Layer type options" at their defaults.
-Click "Save & Edit" button.

Go to Openlayers > Maps tab.

-Find that map you made.
-Click the "Edit" link.
-Click the "Layers" link.
-Hit the checkbox to Enable your new "Layer". Drag it to the bottom so it shows up on top. Actually, to remove any other variations that could cause problems, you should only have your one new layer Enabled. That way you can know if its this layer causing the problem, or some other layer.
-Click "Save & Edit" button.
-Click the "Preview" link.
-Your layer should show up here. Look at the Layer Switcher guy at the bottom and make sure your Layer is there. If you are having any error messages show up here on the page, or in your console, you messed something up. No point in trying to make you map View if you have problems here.

Part 5:

Now back to our map View , the whole point of this post. All of this leads to fixing your "Unable to load CTools exportable source" problem.

Create the View of your Map.

-Enter View name in text box
-Show "Content" of type "Your Content Type"
-Uncheck "Create a page".
-Click "Continue & Edit" button
-Under "Fields" Click "Add" to add your Location Field (or whatever you called it)
-Add a Display. Click "Add" button > Choose "Page".
-For Format choose "Openlayers map".
-For its settings "Base map to use and vector layer to fill with the views features" field choose the Layer we just made. It will be a vector Layer. If you choose some other kind of layer, like a Layer of Tiles, you will get that error again and have no map.
-Under the "Data Source" fieldset change the "Map Data Source" to "WKT".
-For "WKT Field" chose your Location field. If its not there, you forgot to add it.
-For "Title" pick your title.
-Click the "Apply" button.

Now you should have a Map show up. It is possible to have a map display but still get "Unable to load CTools exportable Source undefined." this is because it does not like one of the "Layers" in your Map. Besides, if you are debugging this, you should only have one "Layer" in your map. If this works. Then add more "Layers".

I hope this helps someone. I guess my post turned into a tutorial. Ooops.

-

Again thank you all for your module and everyone's assistance. My heart is full :-)

m.stenta’s picture

Nice! Thanks @joelhsmith! We should get this published in the documentation somewhere...

I agree, I've always used the Views GeoJSON Feed display type and it works great. Using that widely in farmOS: http://drupal.org/project/farm

Now, should we create a bug report for the Openlayers Views auto-generated source issue? I'm not very familiar with it - would someone like to try writing up a new issue? Maybe we can close this one and point people to @joelhsmith's comment from the description?

joelhsmith’s picture

I created a new bug report that clarifies which part of the module is causing the error, and how to replicate it here: https://www.drupal.org/node/2737671 should we close this?

m.stenta’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

@joelhsmith Great! Yes I think we can close this. We can point any newcomers to that issue

In fact I will add a note to the issue description with a link. Thanks again!

Gerhard Roth’s picture

Even with the help of joelsmith (thanks a lot for all his effords) I could not bring his instruction to work on my local machine. I tried the same using simplytest.me. Same result: error message plus no locations on the map

my conclusion of that is
- there may be more error cases than the one joelsmith has identified
- without a more precise error message (or a debug of the error cases) we won't get a solution. So someone should talk to the ctools developers to make a dev version or debug that module. After more than a year of discussion we should come to a more clear understanding of the error
- I would rate that issue a major one since I cannot find out what is neccessary for a successful functioning of the openlayers module
- I will follow the issue but for our organisation I will concentrate on a gmap solution which was working out of the box

m.stenta’s picture

@Gerhard Roth: You tried Openlayers 7.x-3.1 via Simplytest.me and you experienced this issue? Can you please provide steps to reproduce? I am not seeing the issue on simplytest.me, so there must be something I'm not doing.

bmscmoreira’s picture

I am having this issue after deleting a component of a map / a map.

The browser displays:
Fatal error: Call to undefined method Drupal\openlayers\Types\Error::build() in (...)/public_html/sites/all/modules/openlayers-7.x-3.1/openlayers.module on line 65

while the watchdog reports:
"Unable to load CTools exportable Map undefined."

Question is: now, how can I solve this situation, since I can't have access to Drupal admin? (white screen of death).
I've tried clearing the caches in the database, with no luck. After trying to reload the site, they reappear.

Thanks for the help.

Gerhard Roth’s picture

I followed the instruction of joelhsmith point for point but could never avoid the error message.
Because of that I tried the farmOS distribution of Michael Stenta on simplytest.me and found out where the error must be: In the final step part 5 which should bring the map on a drupal page using the "openlayers map" format

Two proves for that:
- the geojson view I created on my test site produces a geojson code which is working fine when added to the "farm area" map of the farmOS distribution as an additional static source. My two locations are on that map. (I have seen them the first time) So until part 4 everything is fine

- the farmOS distribution shows the map by hidden code not by the final view of part 5. When trying to create a map with instruction part 5 on top of the working farmOS structure (with an entered "farm area type field") after changing to format "openlayers map" I immediately get "unable to create exportable map undefined" and after selecting a map layer I get "unable to create exportable source undefined" and of course have no locations on the map.

After saving that view, I could suddenly bring the data onto the map by changing the layer in the settings to a layer what is not the map layer and not the geojson layer containig the data (farm_area_layer_field) to be shown, but any other of the many layers the farmOS application offers. I could reproduce this several times with newly created views.

Thats why I cannot bring the instruction to work on my site because normally you have the map layer and the data layer and nothing else. So that "openlayers map" format is very strange to use and buggy and should be corrected or replaced by anything what is working out of the box. So the issue should be reopened

By the way I tried the case of bmscmoreira by deleting a map. Of course I get the error when the map was used in a view. By recreating it and using it in the view I could repair that.