This project has moved and is read-only. For the latest updates, please go here.

How can I add Here maps tile layer?

Topics: General Topics, WinForms Controls
May 20, 2016 at 2:59 PM
I'd like to add Here maps map tiles to my map by BruTile / SharpMap.

The URL scheme is the following by their documentation: ?app_id={YOUR_APP_ID} &app_code={YOUR_APP_CODE}

where 13 is zoomlevel, 4400 is column, 2686 is row.

Here is my code, but it times out, and map is empty. App id and app code are correct, it is 100% sure. What can be the problem?

var networkRes = Networking.HasInternetConnection();
                    if (networkRes.Result == false)
                        throw new Exception(networkRes.InfoMessage);

                    var uriString = "{z}/{x}/{y}/256/png8";

                    var customParams = new Dictionary<string, string>();
                    customParams.Add("app_id", "someappid");
                    customParams.Add("app_code", "someappcode");

                    var req = new TmsRequest(new Uri(uriString),"png" , customParams);

                    var provider = new WebTileProvider(req);

                    var tileSource = new TileSource(provider, new SphericalMercatorInvertedWorldSchema());

                    TileLayer tileLayer;

                    if (CacheWebMaps)
                        var path = Path.Combine(MapCacheRoot, HEREBASELAYERNAME);
                        tileLayer = new TileLayer(tileSource, HEREBASELAYERNAME, new Color(), true, path);
                        tileLayer = new TileLayer(tileSource, HEREBASELAYERNAME);

                    tileLayer.SRID = 3857;

May 23, 2016 at 8:19 AM
You must not pass the image format to the constructor of the TmsRequest as you have it hard coded in your base url:
var req = new TmsRequest(new Uri(uriString), string.Empty , customParams);