Custom tiling support #75

Merged
merged 10 commits into from Sep 8, 2016

Projects

None yet

3 participants

@MatzFan
Contributor
MatzFan commented May 20, 2016

Fixes #52. Can be tested with contrib PR 24. 4 new metadata [tms] parameters are added:

  • custom_tile_ranges (evaluated as a dict from literal string)
  • custom_tsize1 - which replaces constant TSIZE1 (R * Pi)
  • custom_origin_x
  • custom_origin_y

Solution is intended to be generic & work for any data source. An alternative ESRI/ArcGIS-only solution could read these params from the MapServer url (more elegant, but restrictive). One issue is occasional rendering strangeness (on my QGIS 2.14.0) be interested to know if this is just my setup or a bug.

Happy to update your README if you can merge it.

@MatzFan
Contributor
MatzFan commented May 20, 2016

Forgot: With no test suite, the best regression testing I could do was ensure another layer still worked correctly. FYI the one I used was 'Google Maps' from the contrib. pack (Russian text version)

@simgislab
Member

@MatzFan awesome!

We're are making next big QMS release with GeoJSON, WFS support and more very soon (have an event on 26th of May) and will start working on your PR right after that.

Thanks again, this is very motivating!)

@MatzFan
Contributor
MatzFan commented Jun 13, 2016

Hi folks - any news on when you may look at this, I've another custom tiled layer I'd like to add to contrib?

Thanks

@simgislab
Member

Sorry it is taking a while, hope to get back to it next week.

@MatzFan
Contributor
MatzFan commented Jul 1, 2016

no worries

@MatzFan
Contributor
MatzFan commented Sep 3, 2016

Hi there, any update on this PR? If you don't envisage supporting custom tiling schemes any time soon (the way I've done it or any other way) I may try with another Plugin - or even write my own! No problem either way. Thanks

@simgislab
Member

working on it right now, sorry for the delay!

@alisovenko
Contributor
alisovenko commented Sep 7, 2016 edited

Hi!
We can't check pull request.
Server specified for this link:
https://github.com/nextgis/quickmapservices_contrib/pull/24/files
is not responding.

curl -v -I http://gis.digimap.je/ArcGIS/rest/services/JsyBase/MapServer/tile/0/647/523

  • Hostname was NOT found in DNS cache
  • Trying 212.30.12.104...
  • Connected to gis.digimap.je (212.30.12.104) port 80 (#0)

    HEAD /ArcGIS/rest/services/JsyBase/MapServer/tile/0/647/523 HTTP/1.1
    User-Agent: curl/7.35.0
    Host: gis.digimap.je
    Accept: /

    < HTTP/1.1 404 Not Found
    HTTP/1.1 404 Not Found
    < Content-Length: 0
    Content-Length: 0
    < ETag: 757602046
    ETag: 757602046
  • Server Microsoft-IIS/7.5 is not blacklisted
    < Server: Microsoft-IIS/7.5
    Server: Microsoft-IIS/7.5
    < X-Powered-By: ASP.NET
    X-Powered-By: ASP.NET
    < Date: Wed, 07 Sep 2016 07:52:24 GMT
    Date: Wed, 07 Sep 2016 07:52:24 GMT

Please, can you describe tiling schema? and 'custom_tile_ranges' variable structure?

@MatzFan
Contributor
MatzFan commented Sep 7, 2016

Ok, I see the server address problem; x & y are transposed. Correct address is:
$ curl -v -I http://gis.digimap.je/ArcGIS/rest/services/JsyBase/MapServer/tile/0/523/647
HTTP/1.1 200 OK
Cache-Control: max-age=86400
Content-Length: 160
Content-Type: image/png
ETag: NMikg1mjKA7Nu7jEXx7yeQ==
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Wed, 07 Sep 2016 08:57:06 GMT

custom_tile_ranges is a literal dict, evaluated from the string. The keys are zoom levels and as I recall, each array is structured thus: [ymin, ymax, xmin, xmax]. Take a look at the Tile Info on the MapServer & you'll see how it is put together. This particular layer has 9 zoom levels.

@alisovenko
Contributor

https://github.com/nextgis/quickmapservices/pull/75/files#diff-1e1603b9215702d2680c6b105b681a98R218
xmin, xmax, ymin, ymax = self.layerDef.custom_tile_ranges[zoom]

There is no error?

@MatzFan
Contributor
MatzFan commented Sep 7, 2016

It picked up all the correct tiles from that layer when I ran the code back in May, have not tried since. Let me know what error you are getting & I'll try and set it up in QGIS again later today.

@MatzFan
Contributor
MatzFan commented Sep 7, 2016

Ah, I see x's before y's. Have you tried ymin, ymax, xmin, xmax = self.layerDef.custom_tile_ranges[zoom] instead?

@alisovenko
Contributor

I haven't tried.
Now just looking PR code.
Further I need to merge the code, because code structure of the plugin has changed and there are conflicts.
Then I will test.

@MatzFan
Contributor
MatzFan commented Sep 7, 2016

Understood, I noticed there were conflicts. May be easier to transpose x & y in the contrib file if you need to. Much appreciated that you are now looking at this, I'm away for next hour or two but should be around for questions rest of the day - good luck!

@alisovenko alisovenko merged commit ae45c03 into nextgis:master Sep 8, 2016
@alisovenko
Contributor

I make some changes after merge.
An important change is that the parameter custom_tsize1 from here https://github.com/nextgis/quickmapservices_contrib/pull/24/files
must be size of 1st level tile - not 0 level.
So you need to set this parameter to 4334.9420032175.

My tests were successful.

@MatzFan
Contributor
MatzFan commented Sep 8, 2016

Awesome, I'll change it & re-submit. Look forward to seeing it in QGIS. Much appreciate your efforts to add this functionality.

@MatzFan MatzFan deleted the MatzFan:custom_tiling branch Sep 8, 2016
@simgislab
Member

thanks Alex!

A small question, does it make sense to rename parameters custom_origin_x to origin_x? I don't see why custom_* prefix is necessary.

@alisovenko
Contributor

I'll do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment