Adding OSM base layer to Neatline

Hello,

I'm trying to figure out how to add additional base layers to a neatline map. I don't have the ability to use geoserver, and to start, I'd just like to access some of the many open tile sets available rather than create my own (such as the sets that use OSM data, e.g. opencyclemap, opensurfermap, or OSM grayscale).

I haven't been able to figure out how to do this looking through the documentation and searching the forums. The closest thing I've found is this workflow: https://github.com/csbailey5t/mapboxandtilemill/blob/master/mapbox.tilemill.neatline.documentation.markdown

Which demonstrates how to import custom maps from Mapbox, which gives me some clues, but I haven't been able to transfer this to getting other tile sets to work.

As a very simple example, here is a demo by mclure that uses a different base layer: http://neatline.dclure.org/neatline/show/record-links-demo#records/1526

(I'm not actually sure what tile set he is using there, but it is not one of the default ones, as far as I can tell.)

So, in short: does anyone have info on how to set up other base layers for a neatline map, using one of the many open tile sets (such as the OSM variants)? Can point to a how-to, or care to share their experience setting something up?

Thanks

Hi Fivel,

You found the documentation that we started for a feature in the next version of Neatline. Currently there's a bug in the current release of Neatline that prevents this from working properly.

Is there a particular OSM layer you're wanting to use? Will the default base layers work for your purposes until we can finish up the next release?

Best,
Wayne

Hi Wayne,
Thanks for your reply. The good news is that my needs for different base layers is not immediate or urgent. But it will be necessary for the long-term of my project, so I'm exploring what options are available through which technologies to figure out which I should ultimately work in.

For the moment, it would be great if I could use the tiles used by openstreetmap.se. That color scheme works really well for what I'm working on (still in development, sorry I can't link to it yet).

Though I would also like to make use of the base layers that ESRI/ARCgis has (as well as some of their transparencies, though perhaps that is a different question and I'll save it for later, or at least a different post).

Also curious, since you said what I found was documentation for an upcoming feature -- will there be a way to import these alternative base layers without having to go through mapbox? Mapbox is a useful tool, I'm just wondering if there is currently or will be a way to do similar things without having to involve another service.

Thanks for your help so far.

Hi Wayne,

I'm really struggling to upload a historical map to neatline and wondering if you have any advice...I did the https://github.com/csbailey5t/mapboxandtilemill/blob/master/mapbox.tilemill.neatline.documentation.markdown workflow, but the mapbox.json file seems to stop neatline from working at all when I added it to my omeka folder in the suggested location. I assume that's the bug you reference? Is there a development version of neatline that I could use? If not, can you please remove the workflow from github until it works?

I used that workflow because my wms layer on geoserver isn't working either - the neatline exhibit just opens without a map...I don't desperately need an up-to-date map behind my historical map, I just need to be able to plot points on the historical map, but when I try linking it as a static image, it's way too zoomed in. Is there anything else I can try? I need this for a presentation in a few days and I'm disappointed all my hours trying to get neatline to work might go to waste!

Hi mst,

That issue should be resolved in Neatline 2.4.0. I'm assuming you've georeferenced a tile and moved it to Mapbox. Do you have a public link to the map? What version of Neatline are you using?

Wayne

Hi Wayne,

Thanks for your reply. I managed to get the error message working and it says there's a problem with the syntax (it comes up when I try to click on my neatline exhibit). Here's the error message:

exception 'Zend_Json_Exception' with message 'Decoding failed: Syntax error' in /home/mappingp/public_html/application/libraries/Zend/Json.php:97
Stack trace:
#0 /home/mappingp/public_html/plugins/Neatline/helpers/Layers.php(41): Zend_Json::decode('{\n\n "Mapbox (N...')
#1 /home/mappingp/public_html/plugins/Neatline/helpers/Layers.php(59): nl_getLayers()
#2 /home/mappingp/public_html/plugins/Neatline/forms/Neatline_Form_Exhibit.php(122): nl_getLayersForSelect()
#3 /home/mappingp/public_html/plugins/Neatline/forms/Neatline_Form_Exhibit.php(23): Neatline_Form_Exhibit->_registerElements()
#4 /home/mappingp/public_html/application/libraries/Zend/Form.php(239): Neatline_Form_Exhibit->init()
#5 /home/mappingp/public_html/plugins/Neatline/controllers/ExhibitsController.php(263): Zend_Form->__construct(Array)
#6 /home/mappingp/public_html/plugins/Neatline/controllers/ExhibitsController.php(115): Neatline_ExhibitsController->_getExhibitForm(Object(NeatlineExhibit))
#7 /home/mappingp/public_html/application/libraries/Zend/Controller/Action.php(516): Neatline_ExhibitsController->editAction()
#8 /home/mappingp/public_html/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('editAction')
#9 /home/mappingp/public_html/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#10 /home/mappingp/public_html/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(105): Zend_Controller_Front->dispatch()
#11 /home/mappingp/public_html/application/libraries/Zend/Application.php(382): Zend_Application_Bootstrap_Bootstrap->run()
#12 /home/mappingp/public_html/application/libraries/Omeka/Application.php(79): Zend_Application->run()
#13 /home/mappingp/public_html/admin/index.php(28): Omeka_Application->run()
#14 {main}

I followed the workflow in creating the mapbox.json file, this is what I have:

{

"Mapbox (Neatscape)": [

{
"title": "ParisMap",
"id": "mtootill.m1f4ofd1",
"type": "XYZ",
"properties": {
"url": [
"https://a.tiles.mapbox.com/v4/mtootill.m1f4ofd1/${z}/${x}/${y}.png"
]
}
}

Does it look like there's a problem with my mapbox.json file or is it more likely my georeferenced tile in Mapbox? I'm using the latest version of Neatline.

P.S. Here's the url: https://a.tiles.mapbox.com/v4/mtootill.m1f4ofd1/page.html?access_token=pk.eyJ1IjoibXRvb3RpbGwiLCJhIjoiOUNFcHh6NCJ9.Bo0m7EZhqfmZ3HyNjtilmA#9/-0.5878/-2.7026.

It's not correctly overlaid on a country (it ended up in the sea...), but that doesn't matter. I'm not too bothered about that aspect, I just want the map image so I can create points on it in Neatline.

Hi mst, I think I have a solution for you.

There were two issues. In the id, add Mapbox before your user name. That should fix the error you're getting.

The larger issue is due to access issues. In the url you posted above, you include an access_token. In the url in your mapbox.json file, though, there is no access_token and the server returns an unauthorized access error when trying to get the tiles. You have a couple of options to fix this. You might try changing the visibility of the map so it doesn't require an access token. Or, you can add the access token to the url. If you do that, you'll have a chunk of code like this:

{
"title": "Paris Map",
"id": "Mapbox.mtootill.m1f4ofd1",
"type": "XYZ",
"properties": {
"urls": [
"https://a.tiles.mapbox.com/v4/mtootill.m1f4ofd1/${z}/${x}/${y}.png?access_token=pk.eyJ1IjoibXRvb3RpbGwiLCJhIjoiOUNFcHh6NCJ9.Bo0m7EZhqfmZ3HyNjtilmA"
]
}
}

Doing this did get the map to appear in a Neatline exhibit. However, adding the access token to the URL does make it public.

Hi,

Thanks for explaining the issues with my mapbox.json file, but I'm afraid I'm still having problems. When I make the changes you suggest and have the following as my json code, it still comes up with the same error message (even after deleting and reinstalling Neatline):

{

"Mapbox (Neatscape)": [

{
"title": "Paris Map",
"id": "Mapbox.mtootill.m1f4ofd1",
"type": "XYZ",
"properties": {
"urls": [
"https://a.tiles.mapbox.com/v4/mtootill.m1f4ofd1/${z}/${x}/${y}.png?access_token=pk.eyJ1IjoibXRvb3RpbGwiLCJhIjoiOUNFcHh6NCJ9.Bo0m7EZhqfmZ3HyNjtilmA"
]
}
}

When I tried deleting the first part of the code ("Mapbox" (Neatscape) etc.), the error message no longer appears, but the layer doesn't appear as an option in the layers dropdown menu. I'm not sure what I'm doing differently to you...Does it look like there's a problem with the first part of the code? I just copied that from the workflow,

Thanks!

Mia

Hi,

Thanks for explaining the issues with my mapbox.json file, but I'm afraid I'm still having problems. When I make the changes you suggest and have the following as my json code, it still comes up with the same error message (even after deleting and reinstalling Neatline):

{

"Mapbox (Neatscape)": [

{
"title": "Paris Map",
"id": "Mapbox.mtootill.m1f4ofd1",
"type": "XYZ",
"properties": {
"urls": [
"https://a.tiles.mapbox.com/v4/mtootill.m1f4ofd1/${z}/${x}/${y}.png?access_token=pk.eyJ1IjoibXRvb3RpbGwiLCJhIjoiOUNFcHh6NCJ9.Bo0m7EZhqfmZ3HyNjtilmA"
]
}
}

When I tried deleting the first part of the code ("Mapbox" (Neatscape) etc.), the error message no longer appears, but the layer doesn't appear as an option in the layers dropdown menu. I'm not sure what I'm doing differently to you...Does it look like there's a problem with the first part of the code? I just copied that from the workflow,

Thanks!

Mia

Hi Mia,

It looks like you might be missing a closing square bracket and a closing curly brace. Here is my whole mapbox.json file:

{

"Mapbox (Neatscape)": [

{
"title": "Paris Map",
"id": "Mapbox.mtootill.m1f4ofd1",
"type": "XYZ",
"properties": {
"urls": [
"https://a.tiles.mapbox.com/v4/mtootill.m1f4ofd1/${z}/${x}/${y}.png?access_token=pk.eyJ1IjoibXRvb3RpbGwiLCJhIjoiOUNFcHh6NCJ9.Bo0m7EZhqfmZ3HyNjtilmA"
]
}
}
]
}

Let me know if that fixes it. If not, we'll keep working on it.

Best,
Scott