How to refresh a WMS layer after changing the bound XML

73 views
Skip to first unread message

Deryck Brown

unread,
Dec 3, 2014, 6:57:28 AM12/3/14
to mapi...@googlegroups.com
Hi,

I'm looking at the possibility of using a WMS layer to display custom raster data. However, I don't want the user to be forced to use the MapInfo WMS layer dialog to select the layers, projection and display styles.

I realize that all of this information is saved in the XML file that is bound in the corresponding TAB file.

However, I can't find a way to tell MapInfo to refresh the WMS layer after the XML file has changed.

If I alter the XML outside MapInfo, and then open the WMS table properties, I can see the changes I've made in the resulting dialog. "OK"-ing the dialog causes a refresh, but if I monitor the MapBasic window, there is no command executed when the WMS table properties dialog is closed.

Can anyone help? I don't really want to have to close and open the layer again, as this is likely to cause ugly screen updates.

Thanks,
Deryck

Peter Horsbøll Møller

unread,
Dec 3, 2014, 10:22:07 AM12/3/14
to mapi...@googlegroups.com
Some years back we had an internal hack day where we where working on all kind of weird things.
One thing was a tool that would allow you to easily turn on/off layers in a WMS table.

We had the same issue as you mention here and at that time our solution was to close and reopen the WMS layer.

Here's the procedure that we used to close, reopen and add the WMS layer back to the map window:

SUB CloseAndReopen(ByVal strWMSLayerName as STRING, ByVal intFrontWinID AS INTEGER)

'this is one of the last steps!
'need to:
'1. find the layer order
'2. close the layer
'3. reopen & add to window
Dim intLayerPos as integer
Dim intLayerCount as integer
Dim intCounter as integer
Dim tagFoundLayer as Logical
Dim strFullTABFile as String
Dim fltMapCentreX as Float
Dim fltMapCentreY as Float
Dim fltMapZoom as Float
Set Event Processing Off  

If gtagDebug = TRUE Then
Print "Set Event Processing Off"
End If
intLayerCount = MapperInfo(intFrontWinID, MAPPER_INFO_LAYERS)
strFullTABFile = TableInfo(strWMSLayerName, TAB_INFO_TABFILE)
fltMapCentreX = MapperInfo(intFrontWinID, MAPPER_INFO_CENTERX)
fltMapCentreY = MapperInfo(intFrontWinID, MAPPER_INFO_CENTERY)
fltMapZoom = MapperInfo(intFrontWinID, MAPPER_INFO_Zoom)
tagFoundLayer = False
For intCounter = 1 to intLayercount
If LayerInfo(intFrontWinID, intCounter, LAYER_INFO_NAME) = strWMSLayerName Then
intLayerPos = intCounter
tagFoundLayer = True
If gtagDebug = TRUE Then
Print "Found LayerInfo match!"
Print "intLayerPos: " + str$(intLayerPos)
End If
Else
If gtagDebug = TRUE Then
Print "Check for match: " + LayerInfo(intFrontWinID, intCounter, LAYER_INFO_NAME) + " : " + strWMSLayerName
End If
End If
Next
If tagFoundLayer = True then
If gtagDebug = TRUE Then
Print "Close & Reopen"
End If
'proceed to close & reopen
Close Table strWMSLayerName
Open Table strFullTABFile
Add Map Window intFrontWinID Layer strWMSLayername Position intLayerPos
'now reset mapper stuff
Set Map Window intFrontWinID Center (fltMapCentreX, fltMapCentreY) Zoom fltMapZoom
Else
If gtagDebug = TRUE Then
Print "Don't close - no match found for layername"
End If
End If
If gtagDebug = TRUE Then
Print "Set Event Processing On"
End If
Set Event Processing On

END SUB

Note that this also works for one map window. If they user has the WMS table in multiple map window, you need to extend this to meet those requirements

Peter Horsbøll Møller
Pitney Bowes Software



Date: Wed, 3 Dec 2014 03:57:27 -0800
From: sup...@anatec.com
To: mapi...@googlegroups.com
Subject: [MI-L] How to refresh a WMS layer after changing the bound XML

Hi,

I'm looking at the possibility of using a WMS layer to display custom raster data. However, I don't want the user to be forced to use the MapInfo WMS layer dialog to select the layers, projection and display styles.

I realize that all of this information is saved in the XML file that is bound in the corresponding TAB file.

However, I can't find a way to tell MapInfo to refresh the WMS layer after the XML file has changed.

If I alter the XML outside MapInfo, and then open the WMS table properties, I can see the changes I've made in the resulting dialog. "OK"-ing the dialog causes a refresh, but if I monitor the MapBasic window, there is no command executed when the WMS table properties dialog is closed.

Can anyone help? I don't really want to have to c lose and open the layer again, as this is likely to cause ugly screen updates.

Thanks,
Deryck

--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emai ls from it, send an email to mapinfo-l+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

KK KTG

unread,
Dec 25, 2014, 11:43:45 PM12/25/14
to mapi...@googlegroups.com
Just wondering if there is a user reference in configuring the WMS layers..

Kalai Selvan.K
KTG Infotech
GIS (Mineral Exploration)
Geological Mapping (Historical Map) Data Integration, Analysis, Capturing and Data Conversion
for Geochemistry,IP and Drill logs
Skypes-ktgcad

To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages