Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to share a NetLogo model online

Tags:

netlogo

I'm trying to share my NetLogo model online so that it can be run by others on their laptops or smartphones without NetLogo desktop installed.

I have found that it is possible to run models online with NetLogo web (http://www.netlogoweb.org/launch#http://www.netlogoweb.org/assets/modelslib/Sample%20Models/Biology/Evolution/Cooperation.nlogo) and also possible to upload a model from NetLogo to NetLogo web. The uploaded model can be exported as a .html file.

What I am having trouble with is creating a link for the .html file which others can run. I have tried sharing the .html file name directly and also depositing it in an open access folder in Dropbox and Google Drive. While the link is accessible in Dropbox or Google drive, the file will not run.

Any suggestions for what to try next would be greatly appreciated!

like image 380
PerplexedAW Avatar asked Oct 19 '22 07:10

PerplexedAW


1 Answers

You're far from the first person to run into this problem, so I've added a section to the NetLogo Web FAQ to explain the situation and what the solutions look like. You can find the text here, or inline at the bottom of this post.

However, I don't think you really need the whole mini-essay that I wrote. It sounds to me like you wanted to use Dropbox, but it just wasn't apparent how. As it turns out, the Dropbox documentation provides a good guide for how you can host files publicly on Dropbox. If you follow their instructions, I think you should end up with some files that are easily shareable. Regarding how to specifically use your Dropbox file public URLs with NetLogo Web, you can see the paragraph about Dropbox in the FAQ text for more details.

Text from FAQ:

To put it concisely, the only thing required is a hosting service that allows directly linking to hosted files. However, free and simple to use hosting services are surprisingly few in number these days. We realize that this makes things difficult for many of our users, and we definitely plan to provide our own service that makes this easier for people in the future. For the time being, though, there are still a couple of options that we can suggest.

For the vast majority of NetLogo Web users, a great option is to use Dropbox, which is a cost-free option for file-hosting. To host NetLogo Web files on Dropbox, you must host them publicly (as explained here). Once you've done that, if your file is a .nlogo file, follow the instructions given here, and share the //netlogoweb.org/web?modelURL link, using the public link URL from Dropbox for the modelURL value. If instead, your file is a HTML standalone model (as generated by following the instructions in the section about "Export: HTML" here), then simply share the public link that you got from Dropbox, since it will point directly to the model.

GitHub is also a good alternative to Dropbox for this. Instructions for how to host files on GitHub can be found here.

Another option is to use the Modeling Commons, which is a public space for uploading, sharing, and discussing NetLogo models. All models uploaded to the Modeling Commons have integration with NetLogo Web through the "Run in NetLogo Web" tab on the model's page. For any model, if you open that "Run" tab and then copy your browser's current URL, that URL can be used for direct access to the NetLogo Web version of the model.

One other option (for more advanced users) is to host the files yourself on a public-facing web server that you have access to. If you want to host an HTML standalone model (as generated by following the instructions in the section about "Export: HTML" here), then simply host it and distribute the link to where you're hosting the HTML file.

Hosting a .nlogo file on a web server is more complicated, though. To do that, host the file, and make sure that your web server allows it to be accessed cross-origin. To do this, you might need to have the server set the Access-Control-Allow-Origin header in the .nlogo file's HTTP response to either * or whichever NetLogo Web domain you're using (i.e. http://netlogoweb.org or https://netlogoweb.org or http://netlogo-web.org or https://netlogo-web.org). Then, follow the instructions given here, and share your model through the //netlogoweb.org/web?modelURL link, using the URL of the model on the web server for the modelURL value.

like image 130
Jason Bertsche Avatar answered Oct 21 '22 21:10

Jason Bertsche