How to change the cartographic background (Google Maps) to Offline map?

As I understand it, the farmOS uses the OpenLayers cartographic engine. Can I replace the default view (Google Maps) with my own OpenLayer map? Can I upload my own Openlayer map to the farmOS via the web interface? OpenLayer map I create using qgis2web plugin through QGIS.

That’s correct - farmOS uses OpenLayers to build its maps.

(And worth mentioning: we are in the process of building a standalone farmOS-map.js library, which will be used in both farmOS itself as well as in the Field Kit mobile app. More info here: Starting work on farmOS-map library)

Can I replace the default view (Google Maps) with my own OpenLayer map?

There is a lot of flexibility for changing the way the maps in farmOS work, although right now it requires some knowledge of both OpenLayers and the Drupal OpenLayers module. Once we migrate to the new farmOS-map.js library, it will be a lot simpler - that’s the hope anyway. :slight_smile:

Can I upload my own Openlayer map to the farmOS via the web interface? OpenLayer map I create using qgis2web plugin through QGIS.

No. farmOS does not host its own map layers. But if you have a custom layer that you can host somewhere else (eg: on MapKnitter.org, or by hosting your own GeoServer or MapServer) then you can include it in the farmOS map.

Currently the farmOS map includes OSM (OpenStreetMap) and Google Hybrid (satellite+roads) as base layers. It also includes an NRCS module which adds the NRCS Soil Survey layer to maps, and a MapKnitter module which allows you to include a custom aerial imagery layer that is hosted on MapKnitter.org. So it relies on those services for tile hosting.

But if you’re familiar with hosting tiles, then it wouldn’t be too hard to include your hosted layers in farmOS - especially once the new farmOS-map.js library is integrated!

Here is an example of a farmOS module that includes additional base layers: https://github.com/farmOS/farm_map_no

That adds layers from the Norwegian Mapping Authority. I helped make that module for a farmOS community member in Norway, because the Google imagery was off my a number of meters for his region.

@rkioski on GitHub copied and modified that for Finnish map layers as well in this module: https://github.com/rkioski/farm_map_fi

So that might be a good place to start if you are interested in making a custom map layer module!

Things will change when we integrate farmOS-map.js - so you would have to update accordingly when the time comes - but I’m happy to provide guidance on that. I’ve already started experimenting with what that will look like for farmOS core layers, like the NRCS soil survey: https://github.com/farmOS/farmOS/commit/2e8ab33e1aac6332e27679c0063291af4ca0b898

Thanks for the detailed answers. I launched farmOS on VirtualBox, used Virtual Appliance from turnkey Linux - Drupal. It works just fine. I’ll probably try to deploy Geoserver or MapServer on the same machine.

1 Like

I have had quite a lot of success with Tileserver-php, really light install, doesn’t need much in the ways of software as it just runs on your Apache server with php, the heavy lifting is done with off-site JavaScript. It takes directories of tiles (not figured that one out yet) or MBtiles, which you can export from QGiS really easily (other GIS packages are available…) I’ve been doing some drone maps for background mapping, stitching the images with Microsoft Image Composite Editor (ICE), then georeferencing it in QGIS. Export as an MBtile, and drop it into tileserver.

1 Like

Thanks, nice solution. I tried Tileserver-php, it works.
But how can I simply replace the map in dashboard?

I used the OpenLayers UI to edit the actual maps, but there might be an easier way to hook in the new map… But with OpenLayers UI, you an add a source, layer, and then edit the map. Yea, it might not be the right way, but it worked for me

But how can I simply replace the map in dashboard?

@BobbyMcGear That will require creating a custom module, which provides the OpenLayers Source and Layer definitions, and an implementation of hook_default_openlayers_layers_alter() to stick it into the farmOS map as a new base layer.

See the modules I linked to in my second comment above for examples.