Re: [mapguide-users] Registered provider 'OSGeo.Gdal.4.0' is registered with library for provider 'OSGeo.Gdal.4.1'

2016-09-08 Thread Jackie Ng
This may be an installer bug where I haven't bumped the FDO version to the
correct one.

Does a find/replace of 4.0 -> 4.1 and mgserver restart fix it?

- Jackie



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Registered-provider-OSGeo-Gdal-4-0-is-registered-with-library-for-provider-OSGeo-Gdal-4-1-tp5284754p5284885.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Re: [mapguide-users] change layer definition runtime

2016-09-08 Thread Liglio
You have to refresh the map using javascript.

Put in UtilMap class:
/// 
/// Refresh the Map in the Client using JavaScrit
/// 
/// Page Object calling this method
public void RefreshMapClient(Page objPage)
{
try
{
string strScript = "";

strScript += "" + "\r\n";

// Detect if the page has ScriptManager
if (System.Web.UI.ScriptManager.GetCurrent(objPage) == null)
   
objPage.ClientScript.RegisterStartupScript(objPage.GetType(),
"RefreshMapClient", strScript, false);
else
   
System.Web.UI.ScriptManager.RegisterStartupScript(objPage,
objPage.GetType(), "RefreshMapClient", strScript, false);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}


Put in the your page server-side, after setting the filter layer:
objUtilMap.RefreshMapClient(this);





--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/change-layer-definition-runtime-tp5284382p5284858.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Re: [mapguide-users] change layer definition runtime

2016-09-08 Thread makoychan
Solved the error. I should be getting the mapname from the mapdwiget.

Now there is no error. But it looks like i need to refresh  fusion mapwidget
for the layers to effect. 

Only thing now i think is to refresh the mapwidget for the layers to take
effect. But it seems that  layerTemp.ForceRefresh(); wont refresh the
widget.



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/change-layer-definition-runtime-tp5284382p5284847.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Re: [mapguide-users] change layer definition runtime

2016-09-08 Thread makoychan
Hi Liglio,

Thanks for the quick update, i am getting this error when it reaches 
map.open
 
if i keyed in: resourceService and resourceidentifier
"Resource data was not found: RuntimeData"

if i keyed in: resourceService and mapName or mapdefinition

Invalid resource path: Library://Langan Floor Plans

My scenario is i have fusion, the i am calling the function
mapwidget.getSessionId(), as soon i get the session id, i have a ajax to
call server side method and call

UtilMap up = new UtilMap(sessionid, "Library://Langan Floor Plans/Floor Plan
Map.MapDefinition")

but if i call map.create(resourceIdentifier,"anyName") i works. i can even
access all layers, but is there any difference between the open and create?




--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/change-layer-definition-runtime-tp5284382p5284835.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Re: [mapguide-users] change layer definition runtime

2016-09-08 Thread Liglio
Put in UtilMap class

/// 
/// Get layer object by his name in the Runtime Map
/// 
/// Mapguide MapObject
/// Layer Name
/// 
private MgLayerBase GetLayerByName(MgMap map, string layerName)
{
try
{
MgLayerBase layer = null;
for (int i = 0; i < map.GetLayers().GetCount(); i++)
{
MgLayerBase nextLayer = map.GetLayers().GetItem(i);
if (nextLayer.GetName().ToUpper() ==
layerName.ToUpper())
{
layer = nextLayer;
break;
}
}
return layer;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}

*
using System;
using System.IO;
using System.Xml;
using System.Data;

static public class Util
{
static public string SetTagTextContent(string strXml, 
string strNode,
string strContent, bool bolCreateIfInexist = true, string strNodeCreateAfter
= null)
{
XmlDocument xmlDoc = new XmlDocument();
XmlNode xmlNode = null;
XmlNode xmlNewNode;
XmlNode xmlAfterNode;
string strRet;
string strTag;

xmlDoc.PreserveWhitespace = true;
xmlDoc.LoadXml(strXml);
try
{
xmlNode = xmlDoc.SelectSingleNode(strNode);
if (xmlNode == null && bolCreateIfInexist)
{
strTag = strNode.Substring(strNode.LastIndexOf("/") +
1);
xmlNewNode = xmlDoc.CreateNode(XmlNodeType.Element,
strTag, null);
xmlNewNode.InnerText += " " + strContent;
xmlNode = xmlDoc.SelectSingleNode(strNode.Replace("/" +
strTag, ""));
xmlAfterNode =
xmlDoc.SelectSingleNode(strNodeCreateAfter);
xmlNode.InsertAfter(xmlNewNode, xmlAfterNode);
}
else
{
xmlNode.InnerText = strContent;
}
}
catch (System.Xml.XPath.XPathException)
{
}

strRet = xmlDoc.InnerXml;

return strRet;
}

}



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/change-layer-definition-runtime-tp5284382p5284826.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Re: [mapguide-users] change layer definition runtime

2016-09-08 Thread makoychan
Hi Liglio,

Sorry to have disturbed you but, what namespace did you use for
Util.SetTagTextContent and where is the method GetLayerByName?

Thanks



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/change-layer-definition-runtime-tp5284382p5284823.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Re: [mapguide-users] change layer definition runtime

2016-09-08 Thread makoychan
Thanks Liglio

I will definitely give this  shot. Ill let you know if it works. Thanks
thanks  a bunch.



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/change-layer-definition-runtime-tp5284382p5284819.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Re: [mapguide-users] change layer definition runtime

2016-09-08 Thread Liglio
Hi,

I made an example of a class to manipulate the atribute Filter of a layer,
you can use as an example to manipulate any atribute of a layer. It´s made
in c#.

 public class UtilMap
{
private string strSessionMap;
private string strMapDefinition;
private MgSiteConnection siteConnection;
private MgUserInformation userInfo;
private MgFeatureService featureService;
private MgResourceService resourceService;
private MgMap map;
private string mapName;
private string strTempLayerSufix;

/// 
/// Constructor of class to manipulate the RunTime Mapguide Map 
/// 
/// Map Session ID
/// Map Library Definition
public UtilMap(string pstrSessionMap, string pstrMapDefinition)
{
try
{
strSessionMap = pstrSessionMap;
strMapDefinition = pstrMapDefinition;
strTempLayerSufix = "-" + strSessionMap;

siteConnection = new MgSiteConnection();
userInfo = new MgUserInformation(strSessionMap);

siteConnection.Open(userInfo);
featureService =
(MgFeatureService)siteConnection.CreateService(MgServiceType.FeatureService);
resourceService =
(MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);

mapName = strMapDefinition;

//if mapName is empty, I just want to work with session
repository, no map operations
if (mapName != "")
{
map = new MgMap(siteConnection);
map.Open(resourceService, mapName);
}

}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}

/// 
/// Set a filter to a Layer in session repository
/// 
/// Layer Name
/// Filter condition
/// Operation success
public bool SetLayerFilter(string strLayerName, string strFilter)
{
try
{
//
// Set/Add a filter to a temporary layer created based on an
original one. 
//
MgResourceIdentifier resId, resIdTemp;
MgLayerBase layer, layerTemp;
string tempResource;
string strLayerNameForSession;
string strXml;

//Verify if Layer Name is the temporary layer. If It is,
correct to original Layer Name.
if (strLayerName.IndexOf(strTempLayerSufix) > 0)
{
strLayerName = strLayerName.Replace(strTempLayerSufix,
"");
}

//Use random name to avoid overwrites
strLayerNameForSession = strLayerName +
this.strTempLayerSufix;

//Test if the original or temporary layers existis
if (GetLayerByName(map, strLayerName) == null &&
GetLayerByName(map, strLayerNameForSession) == null)
return false;

//Test if the filter is not null
if (strFilter == null)
strFilter = "";

//Get the temporary layer
layer = GetLayerByName(map, strLayerNameForSession);

//Get the original layer, if temporary later not exist
if (layer == null)
layer = GetLayerByName(map, strLayerName);

//If the temp resource was not created, read the original
xml
tempResource = "Session:" + strSessionMap + "//" +
strLayerNameForSession + "." + MgResourceType.LayerDefinition;
resIdTemp = new MgResourceIdentifier(tempResource);

//Read the resource original layer
resId = layer.GetLayerDefinition();
strXml =
(resourceService.GetResourceContent(resId)).ToString();

//Manipulate xml, set the Tags Filter

strXml = Util.SetTagTextContent(strXml,
"/LayerDefinition/VectorLayerDefinition/Filter", strFilter, true,
"/LayerDefinition/VectorLayerDefinition/FeatureNameType");

//Write the resource
System.Text.ASCIIEncoding encoding = new
System.Text.ASCIIEncoding();
MgByteSource ByteSource = new
MgByteSource(encoding.GetBytes(strXml), strXml.Length);
resourceService.SetResource(resIdTemp,
ByteSource.GetReader(), null);

//Get the temp layer
layerTemp = GetLayerByName(map, strLayerNameForSession);
if (layerTemp == null)
{
layerTemp = new MgLayer(resIdTemp, resourceService);
layerTemp.SetGroup(layer.GetGroup());
layerTemp.SetName(strLayerNameForSession);
layerTemp.SetLegendLabel(strLayerName);
layerT

Re: [mapguide-users] change layer definition runtime

2016-09-08 Thread makoychan
Hi,

I have created layer definition from each maps on Maestro and just 1
MapDefinition, What i am trying to do is the just updated the
layerdefinition of the mapdefinition to the specific selected map. I wanted
to do it runtime. I cam currtently using fusion, is this possible to do on
JS or just .net? And how? i am quite stuck now.

Also another option for me to do is the create mapdefinition on runtime, but
still no success on doing this.

Any help will do.

Thanks in advance 



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/change-layer-definition-runtime-tp5284382p5284782.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users

[mapguide-users] Registered provider 'OSGeo.Gdal.4.0' is registered with library for provider 'OSGeo.Gdal.4.1'

2016-09-08 Thread Liglio
Hi,

I installed mapguide 3.1 beta 2. When I try to create a GDAL feature source,
I can´t validate it. I got the following error. I checked the file
GRFPProvider.dll, and the version product is 4.1.0.0 different from the
providers.xml.


OSGeo.Gdal.4.0
GDAL Provider
FDO Raster Provider for GDAL
False
4.0.0.0
4.0.0.0
.\GRFPProvider.dll
  


Validating resource:
Session:6c6fb962-75d2-11e6-8000-000c297af5e8_en_MTI3LjAuMC4x0AFC0AFB0AFA//64481a97-36b6-4b0f-aeb9-18a6659a26bf.FeatureSource
Error - Error_FeatureSource_ConnectionTestFailed: Connection test failed: 
The remote server returned an error: (559) MgFdoException.: 
An exception occurred in FDO component.
Error occurred in Feature Source
(Session:6c6fb962-75d2-11e6-8000-000c297af5e8_en_MTI3LjAuMC4x0AFC0AFB0AFA//64481a97-36b6-4b0f-aeb9-18a6659a26bf.FeatureSource):
An exception occurred in FDO component.
Error occurred in Feature Source
(Session:6c6fb962-75d2-11e6-8000-000c297af5e8_en_MTI3LjAuMC4x0AFC0AFB0AFA//64481a97-36b6-4b0f-aeb9-18a6659a26bf.FeatureSource):
Failed to de-serialize the schema mappings from the configuration. (Cause:
Registered provider 'OSGeo.Gdal.4.0' is registered with library for provider
'OSGeo.Gdal.4.1'. , Root Cause: Registered provider 'OSGeo.Gdal.4.0' is
registered with library for provider 'OSGeo.Gdal.4.1'. )

- MgFdoConnectionManager.Open() line 333 file
c:\working\build_area\mapguide\3.1.0\x64\mgdev\server\src\common\manager\FdoConnectionManager.cpp
 (Cause: , Root Cause: )

- MgFeatureServiceHandler.ProcessOperation() line 83 file
c:\working\build_area\mapguide\3.1.0\x64\mgdev\server\src\services\feature\FeatureServiceHandler.cpp
- MgOpTestFeatureSourceConnection.Execute() line 100 file
c:\working\build_area\mapguide\3.1.0\x64\mgdev\server\src\services\feature\OpTestFeatureSourceConnection.cpp
- MgServerFeatureService.TestConnection() line 244 file
c:\working\build_area\mapguide\3.1.0\x64\mgdev\server\src\services\feature\ServerFeatureService.cpp
- MgFdoConnectionManager.Open() line 366 file
c:\working\build_area\mapguide\3.1.0\x64\mgdev\server\src\common\manager\FdoConnectionManager.cpp


The remote server returned an error: (559) MgFdoException.



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Registered-provider-OSGeo-Gdal-4-0-is-registered-with-library-for-provider-OSGeo-Gdal-4-1-tp5284754.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users