MapServer REST API
This is a modal window.
The media could not be loaded, either because the server or network failed or because the format is not supported.
Formal Metadata
Title |
| |
Title of Series | ||
Number of Parts | 95 | |
Author | ||
License | CC Attribution - NonCommercial - ShareAlike 3.0 Unported: You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this | |
Identifiers | 10.5446/15558 (DOI) | |
Publisher | ||
Release Date | ||
Language | ||
Production Place | Nottingham |
Content Metadata
Subject Area | ||
Genre | ||
Abstract |
|
FOSS4G Nottingham 201358 / 95
17
25
29
31
32
34
48
50
56
58
68
69
70
82
89
91
00:00
Physical lawRepresentational state transferService (economics)Data managementSoftwareServer (computing)Software architectureSet (mathematics)Scripting languageSimulationSummierbarkeitData modelTexture mappingNumbering schemeConfiguration spaceGroup actionRepresentational state transferLevel (video gaming)Endliche ModelltheorieSingle-precision floating-point formatBitConnected spaceMereologyFormal languageComputer fileFunctional (mathematics)Type theoryData storage deviceData structureStandard deviationConfiguration spaceService (economics)Web 2.0Data managementBuildingOperator (mathematics)CuboidClient (computing)Software frameworkServer (computing)Software architecturePhysical systemGroup actionCodeDirection (geometry)InformationRaster graphicsKeyboard shortcutFrequencyMultilaterationForcing (mathematics)Set (mathematics)SpacetimeMappingWebsiteSymbol tableDisk read-and-write headMatching (graph theory)Flow separationSampling (statistics)Heegaard splittingExtension (kinesiology)Program flowchart
05:26
Group actionData typeTable (information)DatabaseUniform resource locatorConfiguration spaceVirtual machineFile formatRepresentational state transferPhysical lawLinear multistep methodPointer (computer programming)EllipseMaxima and minimaGoogolMenu (computing)Annulus (mathematics)Uniform resource nameKeyboard shortcutConvex hullLengthExecution unitAttribute grammar8 (number)Wide area networkCodeGamma functionComputer configurationData transmissionLatent heatAbstractionTelecommunicationRootRepresentational state transferConnected spaceParameter (computer programming)Configuration spaceFile formatEndliche ModelltheorieType theoryTable (information)DatabaseImplementationInformationGoodness of fitComputer fileGame controllerInterpreter (computing)BitAbstractionElectronic mailing listData storage deviceComputer configurationLevel (video gaming)Data transmissionFront and back endsElectric generatorDampingPlug-in (computing)Complete metric spaceGroup actionUniform resource locatorMaxima and minimaSoftware testingQuicksortSpacetimeBasis <Mathematik>Field (computer science)Multiplication signVirtual machineMatching (graph theory)Set (mathematics)MappingCasting (performing arts)Representation (politics)Moment (mathematics)Workstation <Musikinstrument>State of matterData structureNeuroinformatikComputer animation
10:53
3 (number)TopologyText editorTheory of everythingAverageHill differential equationMoving averageRepresentational state transferInfinityMaxima and minimaSoftware engineeringUniform resource nameRaw image formatAbstractionTouchscreenRevision controlRepresentational state transferCASE <Informatik>MereologyPasswordComputer animationLecture/Conference
11:41
TopologyText editorMaxima and minimaInterior (topology)Metropolitan area networkMIDIRepresentational state transfer3 (number)Decision tree learningQuantumWide area networkArmArtificial neural networkLevel (video gaming)CausalityConnected spaceFront and back endsRepresentational state transferProcess (computing)Uniform resource locatorData storage deviceType theoryComputer fileStreaming mediaDatabaseConfiguration spaceLevel (video gaming)Sampling (statistics)PasswordDirection (geometry)Text editorPlug-in (computing)TelecommunicationMappingData typeMassNetwork topologyNeuroinformatikSpacetimeMathematicsComputer animationLecture/Conference
15:18
Computer animation
15:36
Plug-in (computing)Configuration spaceComputer configurationVideo gameIncidence algebraComplex (psychology)Software testingNeuroinformatikRule of inferenceMultiplication signClient (computing)SoftwareWhiteboardRight angleCASE <Informatik>CausalityRepresentational state transferBitService (economics)MathematicsLevel (video gaming)Computer configurationConfiguration spaceGeometryServer (computing)Focus (optics)Computer fileFront and back endsMereologyShape (magazine)MappingInterface (computing)Open setPlug-in (computing)Latent heatSet (mathematics)Computer animation
Transcript: English(auto-generated)
00:00
make them able to talk to each other directly. We discovered that GeoServer had the REST API, which was allowing people to communicate with it through a standard HTTP requests and methods like get, post, boot, or delete.
00:21
So we decided to implement the same kind of functionalities on the top of MapServer to make it able to understand the same language. That's what we did with the MapServer REST API MRA, which is not so good acronym.
00:42
So because of these API are all the same, they can now discuss each other with the same language and get married. I'm going to explain you a little bit more about MapServer REST API.
01:05
But basically, it's a tool which allows you to configure MapServer services remotely. I mean, like you can do for GeoServer through the REST API. You can do the same with MapServer REST API. It allows you to use the same HTTP request for
01:22
both MapServer and GeoServer, which can be interesting. So it allows you to build services management software, system or whatever that don't rely on a single server backend, but that can communicate with both of them if they are both installed or one of them or the other one if you want to change.
01:46
The overall architecture of MapServer REST API here is quite simple. Over the MapServer standard binaries, you've got the plug-in which is built in Python.
02:04
It uses the same MapServer configuration than the map file. It uses a map file actually. It communicates with it from Python MapScript, and it is open to HTTP requests from the outside,
02:21
coming from a REST client. Little bit of insight, MapServer REST API has been built with the lightweight Python framework web.py which was excellent for dealing with REST requests.
02:43
So you can have those old HTTP requests coming into it, and then the Python code making the stuff work into the map file. For certain type of operation like getting
03:02
the bounding box or information about the raster file or whatever, we are using to the Gelll and audio Python bindings to discover a bit more about the data source. The main problem we had, the most difficult part was to map
03:22
exactly the GeoServer conceptual model from its API to the MapServer conceptual model, which is absolutely not the same, obviously. So the GeoServer conceptual model is based on workspaces, data stores, feature types, coverage stores for rasters,
03:44
and on the side of this, you've got layers and layer groups and even styles. In MapServer, as you might know, you have basically a map file which is a service, and then you have layers, and in the layers, you have a data and you have styles.
04:03
So it's completely different. What we have done is to define the workspace as the map file. So workspace is a map file, and inside it, we have a little bit splitted the layer conceptual approach in a data store approach,
04:24
which is roughly the beginning of the layer, the connection type of the data, and then the feature type which allows access to the data. So it will be the inside part of the data structure of the map file, and then beside this, the styles that can be added.
04:44
So we are completely manipulating the map file through this conceptual model, which is the same as GeoServer. So examples, first, you need to create a new workspace. If you don't have a Scribe UI, for example, to build a map file,
05:01
you can use this. So you first have to declare workspace, which will make a map file. The workspace consent data configuration, which will be used to configure layers. So you make a HTTP post action on your server, MRA workspaces, and you just send this,
05:23
and it's just the name for the workspace, and it will create my workspace.map file. So then when you have this, you have to create a data store into that workspace.
05:40
So you will do a post action on your workspace just created, and on the data stores of your new workspace which now exists, and explain where to find the data, in which database, in which port, which host, use, and so on. As you can see, it is exactly the same
06:04
but the data connection parameters in the map file. After that, you have to declare the feature type for an existing table, because the data store is only a connection to a database.
06:23
So now, on your data store, you just created a step before, you post to the feature types, the name of the feature type you want to use, which is the name of the table where your data are located. So this makes you a workspace, a data store,
06:43
and a feature type, which is not enough in a GeoServer conceptual model to make it available as a layer. So now, you make another post on layers, and you just tell it to use your previous data store
07:04
and feature type, and to publish it. And actually, at that point, it should work. So MapServer REST API, in short, it lets you handle MapServer configuration using HTTP URL and HTTP methods, which can be handy.
07:23
It uses XML or JSON for machine-to-machine communication and representation, and it has a pretty HTML format for machine-to-humans exposure. You can see here. Here, we are hitting the root of the API,
07:42
and it shows you the four main containers. It has the workspaces, the layers, the styles, and the layer groups. And inside the workspaces, we are able... Sorry, it's layers first. Inside the layers, we have a list of all available layers in all workspaces,
08:07
and we can have the same thing in JSON. And then, we can go to workspaces, name of workspaces, the data stores, Nottingham, and feature types, and have information about the data used in this layer.
08:25
Title, the name, the series, and so on. And those are slow. Same thing in XML. What is the future of MapServer REST API?
08:41
It's quite simple. For the moment, we have stayed very close to a Geo7 model, and we know that to build a good map file you often need more options to configure clearly your layer. So we want to add vendor-specific options
09:03
to allow the transmission of MapServer-specific options and to be able to have a better control on the map file. And we want to enhance symbology and label support. Actually, it is done through SLD files,
09:22
which can be not so well interpreted by MapServer, by MapScript, actually. And most of the time, the interpretation differs a bit from GeoServer and MapServer for the same SLD file. So there are things to fix there.
09:42
And if you want to join us, we are on GitHub with MRA. But the story is not finished. One more thing. As an example of implementation of the REST API, as it is not something really visible and usable at start,
10:06
we did a little QGIS plugin implementing both GeoServer and MapServer REST APIs to show you where it can go. It defines a complete abstraction layer above both REST APIs, having a standard control set
10:25
and backend-specific options to be able to tweak a little bit the kind of publication you want to do. And so it allows you to switch painlessly and graphically from one backend to another.
10:44
And it allows, as well, to generate MapServer map files just from scratch. Got the screencast about it. So here, as you see, we have a standard QGIS 2.0 version.
11:06
We load the plugin, click on Close, click on Close, and we configure it. So we add a REST API for GeoServer and its URL.
11:28
And, I mean, user and password. And this allows us to discover, oh, sorry, the pose didn't work so well.
11:43
Okay, I won't pose it. Sorry, it has not a good behavior from the plugin.
12:02
Configure a first backend using GeoServer REST API, its URL. The little tweaks are to enhance the communication between the specific backend.
12:20
And that's it. We retrieve the layers and the workspaces. There's one workspace, Nottingham sample. Sample, it has three feature types and we add them to cart and then to the map. Map, so it's asked for password
12:42
to get the connection to the database because it's a direct connection from QGIS to the database. It doesn't go through a WMS or WFS stream. And we close it and, sorry, it went a little bit fast, but once you have a data there, it's a native QGIS connection to data,
13:01
then you can style them differently and send them back to MapServer by just configuring another backend
13:32
and we publish it to that backend. We're choosing here the layers we want to publish to MapServer. So of course, for the OpenStreetMap layers,
13:41
it doesn't work, but for the visible layers, it can do the job. We choose a workspace to create into MapServer. We're checking the names of a store to be created
14:03
for all of the layers we want to publish, verifying it goes in the correct data store and all the layers were published in MapServer. So now we got this in the API. So we can see our new layers here,
14:20
which have just been added, three feature types for three layers with the styles associated to them. It's an SLD file and we can open this file
14:43
to the text editor and see it's an SLD file. And obviously, if it is in MapServer and if MapServer is correctly configured, we can connect to it through WMS and find all layers and add them to the map
15:02
as now WMS layers and not from that QGIS connections. So you see the style is not exactly the same, it has changed a bit, but not as much as we would like it. So that was a screencast, how to get out of there here.
15:38
So the future of the plugin
15:42
will be to add more configuration options, depending a little bit more on the backend to be used with allowing to set vendor specific options for each backend and even more to tell. That's the end of the story.
16:00
Thank you. What license is it, is it a GPL or something? GPL 3, yeah.
16:22
It's not completely fixed yet, you know, yes. It's not an honest title, it doesn't import the data. It transmits references of the data.
16:41
So both your client side and your server side must be able to connect to the data. Maybe we could push the data as well. The just server REST API allows you to push shape files. So we did the same for shape files, but it doesn't allow you to retrieve shape files.
17:01
So we didn't need it yet. Maybe it could be a specific option for the maps of a backend.
17:30
Yeah, obviously I don't think it would be reasonable to build a full interface to all the stylish map server options.
17:45
The map file is getting more and more complicated or sophisticated maybe with all the cool stuff we have seen before, the complex style and so on. I don't think it would be reasonable to think
18:03
one could control from this kind of API, this kind of renderer, but actually it has two goals. It allows other clients to communicate easily with map server, it's the main topic.
18:22
We first built it with the need to publish geo data from geo network. It was feasible with geo server through the REST API. And so we built it with this first focus
18:42
and then we extended it to other matters. Right. Sure, yeah. To be good at it.
19:02
Okay, we'll do it, thank you. Yes, Daniel. Yes. Are you aware of other issues in the geo-server world that are using the API? No, actually I'm not aware of that.
19:21
That's the only one. So even in the geo-server world, it's not, that's why the- There must be plenty of things in the geo-server world, I don't know. Anyone in the room may know some client dealing with a geo-server REST API maybe, other than geo network.
19:43
Because that's how this would become really useful. Yeah, exactly. Yeah, for Open GeoStreet4 and something, yeah. Bomb that, sorry, there. But do you know if it communicates with geo-server
20:01
through the REST API or? That's a big one, yeah. So it'll be a boundless QGIS plugin, which will enable you to manipulate a map file. But it's just part of just- Yes, yeah, yeah, yeah, yeah.
20:22
And QGIS will be part of this. It's written on the boundless paper board. Big plans, you know. Big business. Big industry. Not yet.
20:43
Okay, no more questions? Thank you very much. Thank you. Thank you.