Tiles with URL template

Apr 4, 2012 at 8:21 PM
Edited Apr 4, 2012 at 8:22 PM

I've previously used BruTile with SharpMap to get tiles from an OSM tile server.  This worked fine with a little trial and error (or maybe a lot of error).  I'm now trying to pull tile data from a Google Fusion server which will be on a closed network.

In the end I used a tile source as found in another thread on this site with code that looked like this:

 

var osmTileSource = new TileSource(new WebTileProvider(
    new TmsRequest(new Uri("http://(myserver)"), "png"), 
        new FileCache(@"c:\temp\filecache", "png")), 
    new SphericalMercatorInvertedWorldSchema());

 

With OSM I was able to create a TmsRequest object which took a URL for the tile server.  It looks like I need to do something similar but with a template for where to put the x, y, and z values in the query string for the Fusion server.  Here are two examples of URLs which are coming out of this server:

http://(myserver)/default_map/query?request=VectorMapsRaster&channel=1001&version=1&x=586&y=783&z=11

http://(myserver)/default/map/query?request=ImageryMaps&channel=1005&version=2&x=4678&y=6267&z=14

Is there a way to form a TmsRequest object which will place the x, y, and z values into a specific position in a template?

Thanks.

Coordinator
Apr 5, 2012 at 2:15 PM

You can use BasicRequest and pass a a format string. Look at the code to know where the X, Y and Z go:

http://brutile.codeplex.com/SourceControl/changeset/view/b3ed21204d13#BruTile%2fWeb%2fBasicRequest.cs

I would like to add an alternative that takes {X}, {Y}, {Z} instead of {0}, {1}, {2}

Paul

Apr 5, 2012 at 7:04 PM

Works perfect.  Just replacing TmsRequest with BasicRequest applies the template.  Thanks for the quick reply.