So tell me, what is the goal of this post?
The goal is that you, too, see a picture like this:
And... why would anyone want this when we have global satellite coverage via Google Maps?
In some parts of the world, Googles satellite imagery is not very accurate. Custom maps allow you to use a better overview of what your Ardupilot is doing.
Another advantage is that the method detailed in this post works completely offline. That means you don't have to prefetch the region in which you are flying.
A third point is that although not detailed in this post all kinds of overlays over map data can be created by your GIS server before displaying the data on MissionPlanner.
Ok so tell me: What do I have to do?
To follow the first steps of this tutorial you need two things: GeoServer, which is an open source WMS (Web Map Service) server and a GeoTIFF image of the region in which you are flying.
For the purpose of this tutorial, I will be using sample data provided by the USGS.
So, download these things:
GeoTIFF: ftp://ftp.remotesensing.org/geotiff/samples/usgs/ (I used c41078a1.tif and c41078a1.lgo)
Create a separate folder, for example "geotiff_examples" somewhere on your computer and put c41078a1.tif and c41078a1.lgo in there.
You said that is for the first steps! What is with the other ones?
Well... the last step currently requires that you download my fork of the MissionPlanner and compile it yourself which is clearly out of scope for this blog post.
If one of the git wizards thinks that my changes are good and helpful this wizard could tell me what to do to get the changes included into the main tree?
The problem currently is that MissionPlanner does not produce completely WMS compliant messages and does not check if the provided WMS server is capable of responding to the MissionPlanner. I fixed that.
My fork is located under https://github.com/korgan/MissionPlanner
tl;dr: That means exactly?
Currently you probably cannot display your image in MissionPlanner.
Okay, lets go; what do I have to do?
Install GeoServer. Installation instructions are located under http://docs.geoserver.org/stable/en/user/installation/index.html
Done. Whats next?
First, you should open your browser and visit the admin homepage, per default it is located at http://localhost:8080/geoserver/web/ . Login and click on "Create Workspaces".
Name the new workspace, in this example I named it "apm_planner_wms" and type in some arbitrary URL. Make it the default workspace. Submit.
Go back to the home screen and click on "Add stores".
Choose the GeoTIFF option. In the next screen, make sure that the workspace is apm_planner_wms, type in a name and a description and browse to the folder where you saved your GeoTIFF from before. Save.
After that, you should see this page:
Click on the "Publish" action. On the following page only one thing is super important: Scroll until you see the "Coordinate Reference System" options. The Declared SRS must be EPSG:4326! You can just type the number in. Save again.
If you do not see it, you have done something wrong (or I failed to mention something...). Please read this part of the tutorial again.
As a last thing to do in GeoServer, you have to go to Workspaces -> apm_planner_wms and make sure, that "WMS" under Services is checked.
Wow, that was alot. I need a nonalcoholic beverage.
I have followed every step. Now I want this litte image from the preview in my Mission Planner!
Heres the thing: As I have said, unless you compile the Mission Planner from my fork, the following steps will not work.
That makes me sad.
I have compiled your Mission Planner! Tell me what to do now!
In the Flight Plan tab on the far right there is a litte scroll down list where you can choose between different maps. Choose "CustomWMS" and adialog should pop up.
Give it the URL of your server ( http://localhost:8080/geoserver/apm_planner_wms/wms ) and click okay. The following box will tell you to choose a layer. Our newly created WMS server has only one layer so we put 0 into the box or just click okay without typing anything.
And there you have it! Our sample tiff is displayed:
Liar! Nothing is displayed! I am ruined, RUINED I say!
Relax. Have a snickers, Did you check that you are at the correct coordinates? The map is quite small, so you have to be around Lat 40.77557094048379 Lng 80.0929875534263
I still do not see anything.
Well, then I forgot a step or you did not follow one.
Your screenshot does not look good at all. Why should I use that again?
Download the sample tiff and zoom in. That is what you get in the Mission Planner, too. And I can tell you that allthough it is not of the very best quality, it is not in the slightest comparable to the low-res screenshot above.
Is there anything more I can do now? This one map is pretty boring.
Yes it is (apart from the fact that maps never are boring). But: You could create your own GeoTIFF. Or you could implement a custom OpenStreetMap server on your laptop. Or you can display other WMS sources like a hydrogeography map of your area or one of the hillshaded maps (http://22.214.171.124/cached/hillshade):
That is Europe if you did not notice.
You convinced me!
Please make sure you say that again in the comments below :-)