Quantcast
Viewing all articles
Browse latest Browse all 2341

New Post: Using offline OpenStreetMap with MapWinGis in a C# Application

Hi there,

i try to use mapServer as TileServer on an Apatche server (ms4w) to access offline osm maps.
The access via Browser still works, but when i try to get the Tiles from the C# application no Tiles are displayed.

Here is the code:
axMap1.Projection = tkMapProjection.PROJECTION_GOOGLE_MERCATOR;
axMap1.ZoomBehavior = tkZoomBehavior.zbUseTileLevels;

TileProviders providers = axMap1.Tiles.Providers;
int providerId = (int)tkTileProvider.ProviderCustom +1;

//bool tmp = providers.Add(providerId, "Custom TMS provider", "http://localhost/cgi-bin/mapserv.exe?map=D:/ms4w/apps/osm/basemaps/osm-google.map&mode=tile&layers=all&tilemode=gmap&tile={x}+{y}+{zoom}.png", tkTileProjection.SphericalMercator, 0, 17);
bool tmp = providers.Add(providerId, "Custom TMS provider", "http://tile.openstreetmap.org/{zoom}/{x}/{y}.png", tkTileProjection.SphericalMercator, 0, 17);
//bool tmp = providers.Add(providerId, "Custom TMS provider", "file:///d:/ms4w/Apache/htdocs/maps/{zoom}/{x}/{y}.png", tkTileProjection.SphericalMercator, 0, 17);

//Check if provider was added
if (tmp == false)
{
    Console.WriteLine(providers.LastErrorCode.ToString());
}

var ut = new Utils();
tkTileProjection pr = axMap1.Tiles.ServerProjection;
GeoProjection gp = ut.TileProjectionToGeoProjection(pr);
axMap1.GeoProjection = gp;
Only when i use openstreetmaps as custom provider everything works fine.
The other urls are accepted by the add method of TileProviders.

(I used the following Tutorial to get the MapServer https://github.com/mapserver/mapserver/wiki/RenderingOsmDataWindows)

Can enybody help me

Viewing all articles
Browse latest Browse all 2341

Trending Articles