Use Arcgis custom provider

Hello, I try to use an ArcGis map server but I can not
I do not know if it is possible to use arcgis with mapwingis?
I found this code but I do not know how it works
Please someone help me or share me a code example
I do not speaker English
I try to explain myself
Thank you!!

VB

    Dim layerHandle As Integer
    layerHandle = -1
    Dim WmsLayer As New MapWinGIS.WmsLayer
    Dim Extents As New MapWinGIS.Extents
    '/Set the wmsLayer properties
    Extents.SetBounds(-180, -90, 0, 0, 90, 0)
    WmsLayer.BaseUrl = "http://10.239.66.20:6080/arcgis/rest/services/Mapa3/MapServer"
    WmsLayer.BoundingBox = Extents
    WmsLayer.Contrast = 1.0
    WmsLayer.DoCaching = False
    WmsLayer.Epsg = 4326
    WmsLayer.Format = "image/png"
    WmsLayer.Gamma = 1.0
    WmsLayer.Layers = "dev_test:infrastructure_100k"
    WmsLayer.Name = "Mapa3"
    WmsLayer.Opacity = 255
    WmsLayer.UseCache = False
    WmsLayer.Id = 1
    WmsLayer.UseTransparentColor = False
    WmsLayer.Key = "1"
    WmsLayer.Version = tkWmsVersion.wvAuto
    WmsLayer.TransparentColor = 255
    WmsLayer.UseTransparentColor = True

    ' If everything Is correct, AddLayer() does the job.
    layerHandle = AxMap1.AddLayer(WmsLayer, True)

    '// Testing purposes, should print "Layers added to the map: 1"
    Console.WriteLine("Layers added to the map: {0}", Me.AxMap1.NumLayers)

Here’s how I have done it. I used the CustomProvider option rather than the WmsLayer option, and I notice that the URL I am using is different. But this is the one we are licensed for; perhaps yours is different, and you may need to modify this accordingly.

Regards.
Jerry.

    Dim ID As Integer = tkTileProvider.ProviderCustom
    ' add custom provider definition
    AxMap1.Tiles.Providers.Add(ID, "ESRI",
        "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{zoom}/{y}/{x}",
        tkTileProjection.SphericalMercator, 0, 19,
        "Esri, DigitalGlobe, GeoEye, i-cubed, USDA FSA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community")

    ' set custom provider
    AxMap1.Tiles.ProviderId = ID

    AxMap1.Redraw3(tkRedrawType.RedrawSkipAllLayers, True)

Thanks Jerry. I try to change the url provider but doesn’t work
Im new in the maps,
I started some days ago , sorry
I use Arcgis Enterprise 10.3

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
    Dim ID As Integer = tkTileProvider.ProviderCustom
    ' add custom provider definition
    AxMap1.Tiles.Providers.Add(ID, "ESRI",
        "http://localhost:6080/arcgis/rest/services/Mapa3/MapServer/tile/{zoom}/{y}/{x}",
        tkTileProjection.SphericalMercator, 0, 19,
        "Esri, DigitalGlobe, GeoEye, i-cubed, USDA FSA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community")

    ' set custom provider
    AxMap1.Tiles.ProviderId = ID

    AxMap1.Redraw3(tkRedrawType.RedrawSkipAllLayers, True)

End Sub

I’m not familiar with ArcGIS anymore but don’t you have a simple javascript page with OpenLayers that will show you that the service is working?

If so you can look at the network requests to see the actual URL.
Then you can paste that url directly in your browser. It should look something like:
http://localhost:6080/arcgis/rest/services/Mapa3/MapServer/tile/12/568/452.png
If that url is showing a tile, you know you’ve got the right url.

Next step is to check if you use the same url in AxMap1.Tiles.Providers.Add()

Another remark is that you need to set the AxMap1 projection to get some tiles or easier is to load a shapefile which has a .prj file.
Then the map knows where it is and will start requesting tiles.

Here’s some more info about tiles in MapWinGIS: https://www.mapwindow.org/documentation/mapwingis4.9/class_tiles.html#details

You can also add some logging: LogFilename

Thanks
This url i use


this info

I don´t find an url similar this

http://localhost:6080/arcgis/rest/services/Mapa3/MapServer/tile/12/568/452.png

I hope not to waste your time, sorry i’m new in maps theme.

My knowledge of ArcGIS is too old/little to assist you with this.

You need to find the actual url of the tiles. That url you need to use in MapWinGIS.

When you open your map in Google Chrome you can open the Developers Tools (F12). In it you have the Network tab. In this tab all Network traffic will be shown.

When you have a demo of your map opened and you pan or zoom you should see the new TMS requests which include the correct URL.

luffy_7557,

I tried Jerry’s method. It worked well. I can see you have a cashed arcGIS server map service with 20 levels (it’s running on your local machine? The url with locahost is for yourself only). You will not find anything like: http://localhost:6080/arcgis/rest/services/Mapa3/MapServer/tile/12/568/452.png on your machine/server. You’ll find the Tile folder on your server. All cached image tiles are stored here by zoom levels. So tile/ {zoom} / {x} / {y} will tell the server where to retrieve the right tiles requested, based on zoom level, and then {x} and {y} are the coordinates of the tile(s), defined from top left corner (x=0, y=0) for each zoom level. So they are all variable and will be populated based on your map scale and location.

Lang

Jerry and pmeems,

When we add the ProviderCustom layer this way, how to get the layerHandle?

Hello @lang

Tiles are not part of the layer mechanism, and as such do not have a layerhandle. They are always displayed below the layers.

There can only be 1 tile provider at any given time, either ProviderCustom, one of the well-knowns, such as OpenStreetMap, or can be turned off by setting ProviderId = ProviderNone.

Jerry,

Very clear. Thank you so much!

Hi @lang is it now working for you?

pmeems,

Which part? If I add the custom layer to checkedList, I cannot hide other layers, but if I don’t do it. All fine. I think the reason is that because the ProviderCustom layer has no layerhandle as Jerry pointed out.

Thanks!

JerryFaust and pmeems,

Can I add a ProviderCutom layer without tiles (not cached, but a dynamic map service)?
Like this:
https://hazards.fema.gov/gis/nfhl/rest/services/public/NFHL/MapServer

Regarding your previous statement, and not knowing the history, I’ll just say that I have managed layer visibility with a checked listbox, including tiled layers; if it is still of interest to you, can you explain what you are trying to do and why it won’t work with the Tiled layer included?

Regarding your latest question, perhaps Paul or someone else has some insight, since I don’t understand much about tiles, however, I assume that you have tried specifying the URL above?

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.