OpenLayers Wrapper - WMTS

Hi everybody,

right now I’m trying to implement a MapTilerLayer which should function as baseLayer for my GIS project.

The constructor of the mapTilerLayer can either be called with bounds and zoomlevels or with the URL.

URL url2 = new URL(url + "tilemapresource.xml");

How does this
tilemapresource.xml
has to look like?

I basically have a WMTS Capabilities xml with the necessary information but don’t know how to feed the MapTilerLayer.

Thanks in advance,
Stefan

Hi,

E.g. this tool creates one for you automatically:
http://www.maptiler.org

Here is one example for you:
https://dl.dropbox.com/u/4041822/pirttikankare/tilemapresource.xml

If I remember correctly it is only the projection and bounding box which are actually needed.

cheers,
matti

Thanks for the fast response:

<Layer>
<ows:Title>Luftbild</ows:Title>
<ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">
<ows:LowerCorner>16.17 48.10</ows:LowerCorner>
<ows:UpperCorner>16.58 48.33</ows:UpperCorner>
</ows:WGS84BoundingBox>
<ows:Identifier>lb</ows:Identifier>
<Style isDefault="true">
<ows:Identifier>farbe</ows:Identifier>
</Style>
<Format>image/jpeg</Format>
<TileMatrixSetLink>
<TileMatrixSet>google3857</TileMatrixSet>
</TileMatrixSetLink>
<ResourceURL format="image/jpeg" template="http://maps1.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg" resourceType="tile"/>
<ResourceURL format="image/jpeg" template="http://maps2.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg" resourceType="tile"/>
<ResourceURL format="image/jpeg" template="http://maps3.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg" resourceType="tile"/>
<ResourceURL format="image/jpeg" template="http://maps4.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg" resourceType="tile"/>
<ResourceURL format="image/jpeg" template="http://maps.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg" resourceType="tile"/>
</Layer>

Not sure how I get my tileSet in the right format for the tilemapresource.xml. Is the MapTilerLayer compareable to OpenLayers WMTS?

Thanks in advance

It appears those are close relatives:

https://groups.google.com/forum/?fromgroups=#!topic/maptiler/LtYJv609rtQ

I have only used the previous “non-standard” version in my hobby projects.

cheers,
matti

GIS is really hard :confused:

As I don’t get it working with the MapTilerLayer I think I would need something like this:

      fmzk = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({
        url: [
            "http://maps.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
            "http://maps1.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
            "http://maps2.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
            "http://maps3.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg",
            "http://maps4.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg"
        ],
        layer: "fmzk",
        style: "pastell",
        transitionEffect: "resize"
    },
    defaults));

To achieve something like this in your project I’d probably need to add 3 classes:
org.vaadin.vol.client.wrapppers.layers WebMapTileServiceLayer
org.vaadin.vol.client.ui VWebMapTileServiceLayer
org.vaadin.vol WebMapTileServiceLayer

Is this correct?

Thanks in advance, Stefan

Hi,

Yes, I think you are on the right path. The first one is a “GWT java-javascript gateway” to access OL api. It also works without Vaadin at all. The last one is the server side class that you actually use in you Vaadin apps and the V prefixed class is the client side counterpart for it, whose purpose is to interpret messages from the server side to the OL.

Did you get the project properly imported into you IDE? Maven should configure it properly. Then you need to recompile the test app widgetset with mvn gwt:compile and launch the VolTestServer as normal java app (yes, the plain old main method).

BTW. What application are you using to create tile sets? Maybe I should look into that too some day.

cheers,
matti

Hi,

import wasn’t a problem just pulled and ran mvn eclipse:eclipse.

Thanks for the explanations… how did you debug those javascript parts?

I’m afraid I can’t help you on the application. It’s a service hosted by the city of vienna. They offered a Capabilties.xml with those tilSets specified.

Best regards,
Stefan

GWT “hosted mode” is a must have. Javascript debuggers also work surprisingly well even with GWT hosted mode. Especially with Webkit based browsers the performance is manageable. Vaadin has Util.browserDebugger() method that is handy to stop the execution at certain point. The test widgetset should GWT compile with “PRETTY” so stepping in js debugger should be somewhat readable.

cheers,
matti

Thanks!

When I run gwt:compile I get the following:


[WARN]
Widget class org.vaadin.vol.client.ui.VWebMapTileServiceLayer was not found. The component org.vaadin.vol.WebMapTileServiceLayer will not be included in the widgetset.

Class does definitely exist… :confused:

Any help is appreciated!

Hi,

Is it in the same package as other V-prefixed classes? GWT expect classes to be inside “client” package that sits next to the GWT module (.gwt.xml file).

cheers,
matti

Yes, it’s in the same package as the other V-named classes
org.vaadin.vol.client.ui

The .gwt.xml sits in
org.vaadin.vol
… haven’t changed anything there.

In the testfile itself I’ve got a div with following content:

Ok made a new clean pull and the problems seem to be solved. No working tile map yet but I’m on my way :wink:

Perfect! I’m eagerly waiting for you patch.

cheers,
matti

JS finally delivers a WMTS Layer … just couldn’t convince it to process the url array yet :wink:

Should that work: new $wnd.OpenLayers.Layer.WMTS($wnd.toOlArray(url)); ??
url is JsArrayString

Thanks in advance,
Stefan

Hi,

I think it should. The helper is needed to re-create array in the host pages scope, otherwise OL will fail to detect the array as array.

cheers,
matti

It’s running allthough not with the array (wich seems to be unnecessary anyway). To date it’s probably only useable for RESTful encoding as you cannot define matrixId arrays.

Should I commit it anyway or wait until I had time to implement the missing functionality?

Best regards,
Stefan

Hi,

Commit early, commit often.

cheers,
matti

Subversion gave me an error on commit ;-/

svn: Server sent unexpected return value (405 Method Not Allowed)

Do I need to register somewhere first?

Best regards,
Stefan

Hi,

You could create a patch and attach it to an issue report in the google code project. I’ll then review the code and commit it. If it looks good I can give your google account some more powers so you can commit next changes directly.

cheers,
matti