Re: [mapguide-users] Create programmatically a map

2009-03-05 Thread Kenneth Skovhede, GEOGRAF A/S

Have you tried posting the document to the webform?
http://localhost/mapguide/mapagent/index.html

Regards, Kenneth Skovhede, GEOGRAF A/S



sekko970 skrev:

Dear all,
I just found the cause of my problem.

My web-layout xml template is a copy of a new layout XML structure created
from MGMaestro:

?xml version=1.0 encoding=utf-8?
WebLayout xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:xsd=http://www.w3.org/2001/XMLSchema;
xsi:noNamespaceSchemaLocation=WebLayout-1.0.0.xsd
TitleMyMapTitle/Title
Map
ResourceIdMyMap.MapDefinition/ResourceId
HyperlinkTargetTaskPane/HyperlinkTarget
/Map
ToolBar
Visibletrue/Visible
Button xsi:type=CommandItemType
FunctionCommand/Function
CommandPrint/Command
/Button
  .
/ToolBar
InformationPane
Visibletrue/Visible
Width200/Width
LegendVisibletrue/LegendVisible
PropertiesVisibletrue/PropertiesVisible
/InformationPane
ContextMenu
Visibletrue/Visible
MenuItem xsi:type=CommandItemType
FunctionCommand/Function
CommandSelect/Command
/MenuItem
 .
/ContextMenu
TaskPane
Visibletrue/Visible
Width280/Width
TaskBar
Visibletrue/Visible
Home
NameHome/Name
TooltipReturn to home task page/Tooltip
DescriptionReturn to home task 
page/Description
ImageURL../stdicons/icon_home.gif/ImageURL

DisabledImageURL../stdicons/icon_home_disabled.gif/DisabledImageURL
/Home
Forward
NameForward/Name
TooltipForward to next task page/Tooltip
DescriptionForward to next task 
page/Description

ImageURL../stdicons/icon_forward.gif/ImageURL

DisabledImageURL../stdicons/icon_forward_disabled.gif/DisabledImageURL
/Forward
Back
NameBack/Name
TooltipReturn to previous task page/Tooltip
DescriptionReturn to previous task 
page/Description
ImageURL../stdicons/icon_back.gif/ImageURL

DisabledImageURL../stdicons/icon_back_disabled.gif/DisabledImageURL
/Back
Tasks
NameTasks/Name
TooltipTask list/Tooltip
DescriptionView a list of available 
tasks/Description
ImageURL../stdicons/icon_tasks.gif/ImageURL

DisabledImageURL../stdicons/icon_tasks_disabled.gif/DisabledImageURL
/Tasks
MenuButton xsi:type=CommandItemType
FunctionCommand/Function
CommandMeasure/Command
/MenuButton
  .
/TaskBar
/TaskPane
StatusBar
Visibletrue/Visible
/StatusBar
ZoomControl
Visibletrue/Visible
/ZoomControl
CommandSet
Command xsi:type=BasicCommandType
NamePan/Name
LabelPan/Label
TooltipPan mode/Tooltip
DescriptionDrag the map to view areas out of 
range/Description
ImageURL../stdicons/icon_pan.gif/ImageURL

DisabledImageURL../stdicons/icon_pan_disabled.gif/DisabledImageURL
TargetViewerAll/TargetViewer
ActionPan/Action
/Command
  .
/CommandSet
/WebLayout


If the XML layout definition contains a button node chilld of toolbar
node, or a MenuItem node chilld of ContextMenu node, or a MenuButton
chilld of TaskPaneTaskBar node, or a Command node chilld of
CommandSet node, it is generated the following error:

The type 'OSGeo.MapGuide.MgNullArgumentException' nell'assembly
'MapGuideDotNetApi, Version = 2.0.2.3011, Culture = neutral, PublicKeyToken
= null' is not marked as serializable.


How can I fix it?
Thanks in advance.
Fabio



Re: [mapguide-users] Create programmatically a map

2009-03-05 Thread sekko970

This is the result of posting:

  ?xml version=1.0 encoding=UTF-8 ? 
- ResourceList xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:noNamespaceSchemaLocation=ResourceList-1.0.0.xsd
- ResourceDocument
  ResourceIdLibrary://MyApp/AppLayouts/MyLayout.WebLayout/ResourceId 
  Depth3/Depth 
  OwnerAdministrator/Owner 
  CreatedDate2009-03-04T15:50:26Z/CreatedDate 
  ModifiedDate2009-03-04T17:02:27Z/ModifiedDate 
- ResourceDocumentHeader
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:noNamespaceSchemaLocation=ResourceDocumentHeader-1.0.0.xsd
- Security xsi:noNamespaceSchemaLocation=ResourceSecurity-1.0.0.xsd
  Inheritedtrue/Inherited 
- Groups
- Group
  NameEveryone/Name 
  Permissionsr,w/Permissions 
  /Group
  /Groups
  /Security
  /ResourceDocumentHeader
  /ResourceDocument
  /ResourceList

I also found that the error is originated if the XML has nodes like
FunctionCommand/Function; if the XML has nodes like
FunctionSeparator/Function, there aren't errors.


Fabio

--


Kenneth Skovhede, GEOGRAF A/S wrote:
 
 Have you tried posting the document to the webform?
 http://localhost/mapguide/mapagent/index.html
 
 Regards, Kenneth Skovhede, GEOGRAF A/S
 
 
 
 sekko970 skrev:
 Dear all,
 I just found the cause of my problem.

 My web-layout xml template is a copy of a new layout XML structure
 created
 from MGMaestro:

 ?xml version=1.0 encoding=utf-8?
 WebLayout xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:xsd=http://www.w3.org/2001/XMLSchema;
 xsi:noNamespaceSchemaLocation=WebLayout-1.0.0.xsd
  TitleMyMapTitle/Title
  Map
  ResourceIdMyMap.MapDefinition/ResourceId
  HyperlinkTargetTaskPane/HyperlinkTarget
  /Map
  ToolBar
  Visibletrue/Visible
  Button xsi:type=CommandItemType
  FunctionCommand/Function
  CommandPrint/Command
  /Button
   .
  /ToolBar
  InformationPane
  Visibletrue/Visible
  Width200/Width
  LegendVisibletrue/LegendVisible
  PropertiesVisibletrue/PropertiesVisible
  /InformationPane
  ContextMenu
  Visibletrue/Visible
  MenuItem xsi:type=CommandItemType
  FunctionCommand/Function
  CommandSelect/Command
  /MenuItem
  .
  /ContextMenu
  TaskPane
  Visibletrue/Visible
  Width280/Width
  TaskBar
  Visibletrue/Visible
  Home
  NameHome/Name
  TooltipReturn to home task page/Tooltip
  DescriptionReturn to home task 
 page/Description
  ImageURL../stdicons/icon_home.gif/ImageURL
  
 DisabledImageURL../stdicons/icon_home_disabled.gif/DisabledImageURL
  /Home
  Forward
  NameForward/Name
  TooltipForward to next task page/Tooltip
  DescriptionForward to next task 
 page/Description
  
 ImageURL../stdicons/icon_forward.gif/ImageURL
  
 DisabledImageURL../stdicons/icon_forward_disabled.gif/DisabledImageURL
  /Forward
  Back
  NameBack/Name
  TooltipReturn to previous task page/Tooltip
  DescriptionReturn to previous task 
 page/Description
  ImageURL../stdicons/icon_back.gif/ImageURL
  
 DisabledImageURL../stdicons/icon_back_disabled.gif/DisabledImageURL
  /Back
  Tasks
  NameTasks/Name
  TooltipTask list/Tooltip
  DescriptionView a list of available 
 tasks/Description
  ImageURL../stdicons/icon_tasks.gif/ImageURL
  
 DisabledImageURL../stdicons/icon_tasks_disabled.gif/DisabledImageURL
  /Tasks
  MenuButton xsi:type=CommandItemType
  FunctionCommand/Function
  CommandMeasure/Command
  /MenuButton
   .
  /TaskBar
  /TaskPane
  StatusBar
  Visibletrue/Visible
  /StatusBar
  ZoomControl
  Visibletrue/Visible
  /ZoomControl
  CommandSet
  Command xsi:type=BasicCommandType
  NamePan/Name
  LabelPan/Label
  TooltipPan mode/Tooltip
  

Re: [mapguide-users] Create programmatically a map

2009-03-05 Thread sekko970

Hi Kenneth,
I solved the problem. I write you the solution, in the hope that it can be
useful.

The error is generated because in my XML template were missing the nodes

PrintLayout
ResourceId/ResourceId
/PrintLayout

as childs of Command xsi:type=PrintCommandType node, even if these nodes
are not generated from MGMaestro saving a new WebLayout as XML, and the
PrintLayout element is descripted as optional (minOccurs=0) in
WebLayout-1.0.0.xsd schema file.


Thanks for your help.
Fabio

--


sekko970 wrote:
 
 This is the result of posting:
 
   ?xml version=1.0 encoding=UTF-8 ? 
 - ResourceList xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:noNamespaceSchemaLocation=ResourceList-1.0.0.xsd
 - ResourceDocument
   ResourceIdLibrary://MyApp/AppLayouts/MyLayout.WebLayout/ResourceId 
   Depth3/Depth 
   OwnerAdministrator/Owner 
   CreatedDate2009-03-04T15:50:26Z/CreatedDate 
   ModifiedDate2009-03-04T17:02:27Z/ModifiedDate 
 - ResourceDocumentHeader
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:noNamespaceSchemaLocation=ResourceDocumentHeader-1.0.0.xsd
 - Security xsi:noNamespaceSchemaLocation=ResourceSecurity-1.0.0.xsd
   Inheritedtrue/Inherited 
 - Groups
 - Group
   NameEveryone/Name 
   Permissionsr,w/Permissions 
   /Group
   /Groups
   /Security
   /ResourceDocumentHeader
   /ResourceDocument
   /ResourceList
 
 I also found that the error is originated if the XML has nodes like
 FunctionCommand/Function; if the XML has nodes like
 FunctionSeparator/Function, there aren't errors.
 
 
 Fabio
 
 --
 
 
 Kenneth Skovhede, GEOGRAF A/S wrote:
 
 Have you tried posting the document to the webform?
 http://localhost/mapguide/mapagent/index.html
 
 Regards, Kenneth Skovhede, GEOGRAF A/S
 
 
 
 sekko970 skrev:
 Dear all,
 I just found the cause of my problem.

 My web-layout xml template is a copy of a new layout XML structure
 created
 from MGMaestro:

 ?xml version=1.0 encoding=utf-8?
 WebLayout xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:xsd=http://www.w3.org/2001/XMLSchema;
 xsi:noNamespaceSchemaLocation=WebLayout-1.0.0.xsd
 TitleMyMapTitle/Title
 Map
 ResourceIdMyMap.MapDefinition/ResourceId
 HyperlinkTargetTaskPane/HyperlinkTarget
 /Map
 ToolBar
 Visibletrue/Visible
 Button xsi:type=CommandItemType
 FunctionCommand/Function
 CommandPrint/Command
 /Button
   .
 /ToolBar
 InformationPane
 Visibletrue/Visible
 Width200/Width
 LegendVisibletrue/LegendVisible
 PropertiesVisibletrue/PropertiesVisible
 /InformationPane
 ContextMenu
 Visibletrue/Visible
 MenuItem xsi:type=CommandItemType
 FunctionCommand/Function
 CommandSelect/Command
 /MenuItem
  .
 /ContextMenu
 TaskPane
 Visibletrue/Visible
 Width280/Width
 TaskBar
 Visibletrue/Visible
 Home
 NameHome/Name
 TooltipReturn to home task page/Tooltip
 DescriptionReturn to home task 
 page/Description
 ImageURL../stdicons/icon_home.gif/ImageURL
 
 DisabledImageURL../stdicons/icon_home_disabled.gif/DisabledImageURL
 /Home
 Forward
 NameForward/Name
 TooltipForward to next task page/Tooltip
 DescriptionForward to next task 
 page/Description
 
 ImageURL../stdicons/icon_forward.gif/ImageURL
 
 DisabledImageURL../stdicons/icon_forward_disabled.gif/DisabledImageURL
 /Forward
 Back
 NameBack/Name
 TooltipReturn to previous task page/Tooltip
 DescriptionReturn to previous task 
 page/Description
 ImageURL../stdicons/icon_back.gif/ImageURL
 
 DisabledImageURL../stdicons/icon_back_disabled.gif/DisabledImageURL
 /Back
 Tasks
 NameTasks/Name
 TooltipTask list/Tooltip
 DescriptionView a list of available 
 tasks/Description
 ImageURL../stdicons/icon_tasks.gif/ImageURL
 
 DisabledImageURL../stdicons/icon_tasks_disabled.gif/DisabledImageURL
 /Tasks
 MenuButton 

Re: [mapguide-users] Create programmatically a map

2009-03-05 Thread Kenneth Skovhede, GEOGRAF A/S

The output shown seems to be from EnumerateResources.
There is no output from posting the Xml in the SetResource call,
except perhaps an error message.

I would like you to try posting the document using SetResource,
and report the results.

Regards, Kenneth Skovhede, GEOGRAF A/S



sekko970 skrev:

This is the result of posting:

  ?xml version=1.0 encoding=UTF-8 ? 
- ResourceList xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;

xsi:noNamespaceSchemaLocation=ResourceList-1.0.0.xsd
- ResourceDocument
  ResourceIdLibrary://MyApp/AppLayouts/MyLayout.WebLayout/ResourceId 
  Depth3/Depth 
  OwnerAdministrator/Owner 
  CreatedDate2009-03-04T15:50:26Z/CreatedDate 
  ModifiedDate2009-03-04T17:02:27Z/ModifiedDate 
- ResourceDocumentHeader

xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:noNamespaceSchemaLocation=ResourceDocumentHeader-1.0.0.xsd
- Security xsi:noNamespaceSchemaLocation=ResourceSecurity-1.0.0.xsd
  Inheritedtrue/Inherited 
- Groups

- Group
  NameEveryone/Name 
  Permissionsr,w/Permissions 
  /Group

  /Groups
  /Security
  /ResourceDocumentHeader
  /ResourceDocument
  /ResourceList

I also found that the error is originated if the XML has nodes like
FunctionCommand/Function; if the XML has nodes like
FunctionSeparator/Function, there aren't errors.


Fabio

--


Kenneth Skovhede, GEOGRAF A/S wrote:
  

Have you tried posting the document to the webform?
http://localhost/mapguide/mapagent/index.html

Regards, Kenneth Skovhede, GEOGRAF A/S



sekko970 skrev:


Dear all,
I just found the cause of my problem.

My web-layout xml template is a copy of a new layout XML structure
created
from MGMaestro:

?xml version=1.0 encoding=utf-8?
WebLayout xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:xsd=http://www.w3.org/2001/XMLSchema;
xsi:noNamespaceSchemaLocation=WebLayout-1.0.0.xsd
TitleMyMapTitle/Title
Map
ResourceIdMyMap.MapDefinition/ResourceId
HyperlinkTargetTaskPane/HyperlinkTarget
/Map
ToolBar
Visibletrue/Visible
Button xsi:type=CommandItemType
FunctionCommand/Function
CommandPrint/Command
/Button
  .
/ToolBar
InformationPane
Visibletrue/Visible
Width200/Width
LegendVisibletrue/LegendVisible
PropertiesVisibletrue/PropertiesVisible
/InformationPane
ContextMenu
Visibletrue/Visible
MenuItem xsi:type=CommandItemType
FunctionCommand/Function
CommandSelect/Command
/MenuItem
 .
/ContextMenu
TaskPane
Visibletrue/Visible
Width280/Width
TaskBar
Visibletrue/Visible
Home
NameHome/Name
TooltipReturn to home task page/Tooltip
DescriptionReturn to home task 
page/Description
ImageURL../stdicons/icon_home.gif/ImageURL

DisabledImageURL../stdicons/icon_home_disabled.gif/DisabledImageURL
/Home
Forward
NameForward/Name
TooltipForward to next task page/Tooltip
DescriptionForward to next task 
page/Description

ImageURL../stdicons/icon_forward.gif/ImageURL

DisabledImageURL../stdicons/icon_forward_disabled.gif/DisabledImageURL
/Forward
Back
NameBack/Name
TooltipReturn to previous task page/Tooltip
DescriptionReturn to previous task 
page/Description
ImageURL../stdicons/icon_back.gif/ImageURL

DisabledImageURL../stdicons/icon_back_disabled.gif/DisabledImageURL
/Back
Tasks
NameTasks/Name
TooltipTask list/Tooltip
DescriptionView a list of available 
tasks/Description
ImageURL../stdicons/icon_tasks.gif/ImageURL

DisabledImageURL../stdicons/icon_tasks_disabled.gif/DisabledImageURL
/Tasks
MenuButton xsi:type=CommandItemType
FunctionCommand/Function
CommandMeasure/Command
/MenuButton
  

Re: [mapguide-users] Create programmatically a map

2009-03-04 Thread sekko970

Dear all,
I just found the cause of my problem.

My web-layout xml template is a copy of a new layout XML structure created
from MGMaestro:

?xml version=1.0 encoding=utf-8?
WebLayout xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:xsd=http://www.w3.org/2001/XMLSchema;
xsi:noNamespaceSchemaLocation=WebLayout-1.0.0.xsd
TitleMyMapTitle/Title
Map
ResourceIdMyMap.MapDefinition/ResourceId
HyperlinkTargetTaskPane/HyperlinkTarget
/Map
ToolBar
Visibletrue/Visible
Button xsi:type=CommandItemType
FunctionCommand/Function
CommandPrint/Command
/Button
  .
/ToolBar
InformationPane
Visibletrue/Visible
Width200/Width
LegendVisibletrue/LegendVisible
PropertiesVisibletrue/PropertiesVisible
/InformationPane
ContextMenu
Visibletrue/Visible
MenuItem xsi:type=CommandItemType
FunctionCommand/Function
CommandSelect/Command
/MenuItem
 .
/ContextMenu
TaskPane
Visibletrue/Visible
Width280/Width
TaskBar
Visibletrue/Visible
Home
NameHome/Name
TooltipReturn to home task page/Tooltip
DescriptionReturn to home task 
page/Description
ImageURL../stdicons/icon_home.gif/ImageURL

DisabledImageURL../stdicons/icon_home_disabled.gif/DisabledImageURL
/Home
Forward
NameForward/Name
TooltipForward to next task page/Tooltip
DescriptionForward to next task 
page/Description

ImageURL../stdicons/icon_forward.gif/ImageURL

DisabledImageURL../stdicons/icon_forward_disabled.gif/DisabledImageURL
/Forward
Back
NameBack/Name
TooltipReturn to previous task page/Tooltip
DescriptionReturn to previous task 
page/Description
ImageURL../stdicons/icon_back.gif/ImageURL

DisabledImageURL../stdicons/icon_back_disabled.gif/DisabledImageURL
/Back
Tasks
NameTasks/Name
TooltipTask list/Tooltip
DescriptionView a list of available 
tasks/Description
ImageURL../stdicons/icon_tasks.gif/ImageURL

DisabledImageURL../stdicons/icon_tasks_disabled.gif/DisabledImageURL
/Tasks
MenuButton xsi:type=CommandItemType
FunctionCommand/Function
CommandMeasure/Command
/MenuButton
  .
/TaskBar
/TaskPane
StatusBar
Visibletrue/Visible
/StatusBar
ZoomControl
Visibletrue/Visible
/ZoomControl
CommandSet
Command xsi:type=BasicCommandType
NamePan/Name
LabelPan/Label
TooltipPan mode/Tooltip
DescriptionDrag the map to view areas out of 
range/Description
ImageURL../stdicons/icon_pan.gif/ImageURL

DisabledImageURL../stdicons/icon_pan_disabled.gif/DisabledImageURL
TargetViewerAll/TargetViewer
ActionPan/Action
/Command
  .
/CommandSet
/WebLayout


If the XML layout definition contains a button node chilld of toolbar
node, or a MenuItem node chilld of ContextMenu node, or a MenuButton
chilld of TaskPaneTaskBar node, or a Command node chilld of
CommandSet node, it is generated the following error:

The type 'OSGeo.MapGuide.MgNullArgumentException' nell'assembly
'MapGuideDotNetApi, Version = 2.0.2.3011, Culture = neutral, PublicKeyToken
= null' is not marked as serializable.


How can I fix it?
Thanks in advance.
Fabio


--


Kenneth Skovhede, GEOGRAF A/S wrote:
 
 There are/were problems reading data using the MgByteReader, as it would 
 not return more than 8K.
 You 

Re: [mapguide-users] Create programmatically a map

2009-02-18 Thread sekko970

Hi Kenneth,
I need again your help about my problem.

I think the problem is that after new map run-time creation in library
repository, I cannot use its map definition to create its web layout.

How can I assign the new map to the layout?

Thanks again, Fabio

--


Kenneth Skovhede, GEOGRAF A/S wrote:
 
 Try to look at the Maestro code:
 http://trac.osgeo.org/mapguide/browser/trunk/Tools/Maestro/MaestroAPI/LocalNativeConnection.cs#L182
 
 Hopefully you will find a small difference there.
 
 Regards, Kenneth Skovhede, GEOGRAF A/S
 
 
 
 sekko970 skrev:
 Yes, the OuterXml property contains the XML header line.
 Fabio

 --


 Kenneth Skovhede, GEOGRAF A/S wrote:
   
 Does the OuterXml property contain the ? version=1.0 
 encoding=utf-8 standalone=true ? line?

 Regards, Kenneth Skovhede, GEOGRAF A/S



 sekko970 skrev:
 
 Hi Kenneth, and thanks for your promptly reply.

 I had used an ancoding instance.

 Below, you can see my code to create the new map:

 Dim resID As New
 MgResourceIdentifier(Library://.../maps/MyMap.MapDefinition)

 Dim enc As New System.Text.UTF8Encoding(False)

 Dim newMapDef As New
 MgByteSource(enc.GetBytes(XMLMapTemplate.OuterXml),
 enc.GetByteCount(XMLMapTemplate.OuterXml))

 newMapDef.SetMimeType(MgMimeType.Xml)

 Dim resourceSrvc As MgResourceService =
 siteConn.CreateService(MgServiceType.ResourceService)

 resourceSrvc.SetResource(resID, newMapDef.GetReader(), Nothing)

 Dim map As New MgMap()

 map.Create(resourceSrvc, resID, MapName)

 ...

 Then, this is my code to create the map layout:

 Dim resID As New
 MgResourceIdentifier(Library://.../Layouts/MyMap.WebLayout)

 Dim enc As New System.Text.UTF8Encoding(False)

 Dim newLayoutDef As New
 MgByteSource(enc.GetBytes(XMLLayoutTemplate.OuterXml),
 enc.GetByteCount(XMLLayoutTemplate.OuterXml))

 newLayoutDef.SetMimeType(MgMimeType.Xml)

 resourceSrvc As MgResourceService =
 siteConn.CreateService(MgServiceType.ResourceService)

 resourceSrvc.SetResource(resID, newLayoutDef.GetReader(), Nothing)

 map.Save(resourceSrvc)


 Thanks for your help.
 Fabio

 --


 Kenneth Skovhede, GEOGRAF A/S wrote:
   
   
 You could have the problem that .Net emits an utf-8 byte-order-marker 
 (BOM), when
 writing xml.
 http://en.wikipedia.org/wiki/Byte-order_mark

 To counter this, explicitly create an encoding instance:
 System.Text.Encoding enc = new System.Text.UTF8Encoding(false);

 Then implement a xml writer, or manually convert the xml to bytes,
 using 
 the encoding.

 FYI, the MaestroAPI is LGPL, and so you may use it as a library, even 
 for commercial applications,
 and it handles this quirk and others.

 Regards, Kenneth Skovhede, GEOGRAF A/S



 sekko970 skrev:
 
 
 Dear all,

 I have created programmatically a map (and its layout) using MG .Net
 web
 API.
 After creation, the new map and layout are visible in MG Maestro, and
 using
 the 'Show in browser button are correctly shown in browser.

 The problem happens when I load the map directly from browser, and
 the
 following error appears:
  The type 'OSGeo.MapGuide.MgNullArgumentException' in assembly
 'MapGuideDotNetApi, Version= 2.0.2.30 11, Culture=neutral,
 PublicKeyToken=null' is not marked as serializable .

 Then, simply saving the new layout from MG Maestro (without any
 modification), and reloading the map directly from browser, the error
 disappears and the map is correctly shown.

 After saving the layout, there aren't differences in map and layout
 XML
 definitions.

 Have you any idea about?
 Thank you in advance.
 Fabio

   
   
   
 ___
 mapguide-users mailing list
 mapguide-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapguide-users


 
 
   
   
 ___
 mapguide-users mailing list
 mapguide-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapguide-users


 

   
 
 ___
 mapguide-users mailing list
 mapguide-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapguide-users
 
 

-- 
View this message in context: 
http://n2.nabble.com/Create-programmatically-a-map-tp2314238p2345737.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] Create programmatically a map

2009-02-18 Thread Ivan Milicevic
Hello,

You can change href of mapFrame. Here is sample code.

var mapa = cijevi; //defines map name
var stringMape = Library%3a%2f%2fPROJEKTI%2fSUPRANET%2fMAPE%2f + mapa;
var hrefMapa =
http://172.21.10.3/mapguide/mapviewernet/mapframe.aspx?MAPDEFINITION=;
+ stringMape +
.MapDefinitionamp;TYPE=HTMLamp;SHOWLEGEND=0amp;SHOWPROP=0amp;INFOWI
DTH=0amp;LOCALE=enamp;HLTGT=1amp;HLTGTNAME=amp;SHOWSLIDER=0amp;SESS
ION= + mgSessionId + ;

//changing mapFrame href
mapFrame.location.href = hrefMapa;


Hope this helps.

-Original Message-
From: mapguide-users-boun...@lists.osgeo.org
[mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
Sent: Wednesday, February 18, 2009 9:57 AM
To: mapguide-users@lists.osgeo.org
Subject: Re: [mapguide-users] Create programmatically a map


Hi Kenneth,
I need again your help about my problem.

I think the problem is that after new map run-time creation in library
repository, I cannot use its map definition to create its web layout.

How can I assign the new map to the layout?

Thanks again, Fabio


--


Kenneth Skovhede, GEOGRAF A/S wrote:
 
 Try to look at the Maestro code:

http://trac.osgeo.org/mapguide/browser/trunk/Tools/Maestro/MaestroAPI/Lo
calNativeConnection.cs#L182
 
 Hopefully you will find a small difference there.
 
 Regards, Kenneth Skovhede, GEOGRAF A/S
 
 
 
 sekko970 skrev:
 Yes, the OuterXml property contains the XML header line.
 Fabio



--


 Kenneth Skovhede, GEOGRAF A/S wrote:
   
 Does the OuterXml property contain the ? version=1.0 
 encoding=utf-8 standalone=true ? line?

 Regards, Kenneth Skovhede, GEOGRAF A/S



 sekko970 skrev:
 
 Hi Kenneth, and thanks for your promptly reply.

 I had used an ancoding instance.

 Below, you can see my code to create the new map:

 Dim resID As New
 MgResourceIdentifier(Library://.../maps/MyMap.MapDefinition)

 Dim enc As New System.Text.UTF8Encoding(False)

 Dim newMapDef As New
 MgByteSource(enc.GetBytes(XMLMapTemplate.OuterXml),
 enc.GetByteCount(XMLMapTemplate.OuterXml))

 newMapDef.SetMimeType(MgMimeType.Xml)

 Dim resourceSrvc As MgResourceService =
 siteConn.CreateService(MgServiceType.ResourceService)

 resourceSrvc.SetResource(resID, newMapDef.GetReader(), Nothing)

 Dim map As New MgMap()

 map.Create(resourceSrvc, resID, MapName)

 ...

 Then, this is my code to create the map layout:

 Dim resID As New
 MgResourceIdentifier(Library://.../Layouts/MyMap.WebLayout)

 Dim enc As New System.Text.UTF8Encoding(False)

 Dim newLayoutDef As New
 MgByteSource(enc.GetBytes(XMLLayoutTemplate.OuterXml),
 enc.GetByteCount(XMLLayoutTemplate.OuterXml))

 newLayoutDef.SetMimeType(MgMimeType.Xml)

 resourceSrvc As MgResourceService =
 siteConn.CreateService(MgServiceType.ResourceService)

 resourceSrvc.SetResource(resID, newLayoutDef.GetReader(), Nothing)

 map.Save(resourceSrvc)


 Thanks for your help.
 Fabio



--


 Kenneth Skovhede, GEOGRAF A/S wrote:
   
   
 You could have the problem that .Net emits an utf-8
byte-order-marker 
 (BOM), when
 writing xml.
 http://en.wikipedia.org/wiki/Byte-order_mark

 To counter this, explicitly create an encoding instance:
 System.Text.Encoding enc = new System.Text.UTF8Encoding(false);

 Then implement a xml writer, or manually convert the xml to bytes,
 using 
 the encoding.

 FYI, the MaestroAPI is LGPL, and so you may use it as a library,
even 
 for commercial applications,
 and it handles this quirk and others.

 Regards, Kenneth Skovhede, GEOGRAF A/S



 sekko970 skrev:
 
 
 Dear all,

 I have created programmatically a map (and its layout) using MG
.Net
 web
 API.
 After creation, the new map and layout are visible in MG Maestro,
and
 using
 the 'Show in browser button are correctly shown in browser.

 The problem happens when I load the map directly from browser,
and
 the
 following error appears:
  The type 'OSGeo.MapGuide.MgNullArgumentException' in assembly
 'MapGuideDotNetApi, Version= 2.0.2.30 11, Culture=neutral,
 PublicKeyToken=null' is not marked as serializable .

 Then, simply saving the new layout from MG Maestro (without any
 modification), and reloading the map directly from browser, the
error
 disappears and the map is correctly shown.

 After saving the layout, there aren't differences in map and
layout
 XML
 definitions.

 Have you any idea about?
 Thank you in advance.
 Fabio

   
   
   
 ___
 mapguide-users mailing list
 mapguide-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapguide-users


 
 
   
   
 ___
 mapguide-users mailing list
 mapguide-users@lists.osgeo.org
 http://lists.osgeo.org

RE: [mapguide-users] Create programmatically a map

2009-02-18 Thread sekko970

Hi Ivan,

thanks for your suggestion, but my problem is not to refresh the viewer to
show the map just created, but is the correct creation of new map and
layout.

I think to have found the origin of my problem, but I don't understand the
error:

Argument is null. Exception occurred in method MgWebLayout.ParsePrintCommand
at line 880 in file
c:\build_bond_area\bond_nightly\build_41.3\ent\os\web\src\webapp\WebLayout.cpp 

Have you some idea?
Thanks, Fabio

--


Ivan Milicevic wrote:
 
 Hello,
 
 You can change href of mapFrame. Here is sample code.
 
 var mapa = cijevi; //defines map name
 var stringMape = Library%3a%2f%2fPROJEKTI%2fSUPRANET%2fMAPE%2f + mapa;
 var hrefMapa =
 http://172.21.10.3/mapguide/mapviewernet/mapframe.aspx?MAPDEFINITION=;
 + stringMape +
 .MapDefinitionamp;TYPE=HTMLamp;SHOWLEGEND=0amp;SHOWPROP=0amp;INFOWI
 DTH=0amp;LOCALE=enamp;HLTGT=1amp;HLTGTNAME=amp;SHOWSLIDER=0amp;SESS
 ION= + mgSessionId + ;
 
 //changing mapFrame href
 mapFrame.location.href = hrefMapa;
 
 
 Hope this helps.
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 9:57 AM
 To: mapguide-users@lists.osgeo.org
 Subject: Re: [mapguide-users] Create programmatically a map
 
 
 Hi Kenneth,
 I need again your help about my problem.
 
 I think the problem is that after new map run-time creation in library
 repository, I cannot use its map definition to create its web layout.
 
 How can I assign the new map to the layout?
 
 Thanks again, Fabio
 
 
 --
 
 
 Kenneth Skovhede, GEOGRAF A/S wrote:
 
 Try to look at the Maestro code:

 http://trac.osgeo.org/mapguide/browser/trunk/Tools/Maestro/MaestroAPI/Lo
 calNativeConnection.cs#L182
 
 Hopefully you will find a small difference there.
 
 Regards, Kenneth Skovhede, GEOGRAF A/S
 
 
 
 sekko970 skrev:
 Yes, the OuterXml property contains the XML header line.
 Fabio


 
 --


 Kenneth Skovhede, GEOGRAF A/S wrote:
   
 Does the OuterXml property contain the ? version=1.0 
 encoding=utf-8 standalone=true ? line?

 Regards, Kenneth Skovhede, GEOGRAF A/S



 sekko970 skrev:
 
 Hi Kenneth, and thanks for your promptly reply.

 I had used an ancoding instance.

 Below, you can see my code to create the new map:

 Dim resID As New
 MgResourceIdentifier(Library://.../maps/MyMap.MapDefinition)

 Dim enc As New System.Text.UTF8Encoding(False)

 Dim newMapDef As New
 MgByteSource(enc.GetBytes(XMLMapTemplate.OuterXml),
 enc.GetByteCount(XMLMapTemplate.OuterXml))

 newMapDef.SetMimeType(MgMimeType.Xml)

 Dim resourceSrvc As MgResourceService =
 siteConn.CreateService(MgServiceType.ResourceService)

 resourceSrvc.SetResource(resID, newMapDef.GetReader(), Nothing)

 Dim map As New MgMap()

 map.Create(resourceSrvc, resID, MapName)

 ...

 Then, this is my code to create the map layout:

 Dim resID As New
 MgResourceIdentifier(Library://.../Layouts/MyMap.WebLayout)

 Dim enc As New System.Text.UTF8Encoding(False)

 Dim newLayoutDef As New
 MgByteSource(enc.GetBytes(XMLLayoutTemplate.OuterXml),
 enc.GetByteCount(XMLLayoutTemplate.OuterXml))

 newLayoutDef.SetMimeType(MgMimeType.Xml)

 resourceSrvc As MgResourceService =
 siteConn.CreateService(MgServiceType.ResourceService)

 resourceSrvc.SetResource(resID, newLayoutDef.GetReader(), Nothing)

 map.Save(resourceSrvc)


 Thanks for your help.
 Fabio


 
 --


 Kenneth Skovhede, GEOGRAF A/S wrote:
   
   
 You could have the problem that .Net emits an utf-8
 byte-order-marker 
 (BOM), when
 writing xml.
 http://en.wikipedia.org/wiki/Byte-order_mark

 To counter this, explicitly create an encoding instance:
 System.Text.Encoding enc = new System.Text.UTF8Encoding(false);

 Then implement a xml writer, or manually convert the xml to bytes,
 using 
 the encoding.

 FYI, the MaestroAPI is LGPL, and so you may use it as a library,
 even 
 for commercial applications,
 and it handles this quirk and others.

 Regards, Kenneth Skovhede, GEOGRAF A/S



 sekko970 skrev:
 
 
 Dear all,

 I have created programmatically a map (and its layout) using MG
 .Net
 web
 API.
 After creation, the new map and layout are visible in MG Maestro,
 and
 using
 the 'Show in browser button are correctly shown in browser.

 The problem happens when I load the map directly from browser,
 and
 the
 following error appears:
  The type 'OSGeo.MapGuide.MgNullArgumentException' in assembly
 'MapGuideDotNetApi, Version= 2.0.2.30 11, Culture=neutral,
 PublicKeyToken=null' is not marked as serializable .

 Then, simply saving the new layout from

RE: [mapguide-users] Create programmatically a map

2009-02-18 Thread Ivan Milicevic
Can you provide us code sample?

-Original Message-
From: mapguide-users-boun...@lists.osgeo.org
[mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
Sent: Wednesday, February 18, 2009 10:38 AM
To: mapguide-users@lists.osgeo.org
Subject: RE: [mapguide-users] Create programmatically a map


Hi Ivan,

thanks for your suggestion, but my problem is not to refresh the viewer
to
show the map just created, but is the correct creation of new map and
layout.

I think to have found the origin of my problem, but I don't understand
the
error:

Argument is null. Exception occurred in method
MgWebLayout.ParsePrintCommand
at line 880 in file
c:\build_bond_area\bond_nightly\build_41.3\ent\os\web\src\webapp\WebLayo
ut.cpp 

Have you some idea?
Thanks, Fabio


--


Ivan Milicevic wrote:
 
 Hello,
 
 You can change href of mapFrame. Here is sample code.
 
 var mapa = cijevi; //defines map name
 var stringMape = Library%3a%2f%2fPROJEKTI%2fSUPRANET%2fMAPE%2f +
mapa;
 var hrefMapa =

http://172.21.10.3/mapguide/mapviewernet/mapframe.aspx?MAPDEFINITION=;
 + stringMape +

.MapDefinitionamp;TYPE=HTMLamp;SHOWLEGEND=0amp;SHOWPROP=0amp;INFOWI

DTH=0amp;LOCALE=enamp;HLTGT=1amp;HLTGTNAME=amp;SHOWSLIDER=0amp;SESS
 ION= + mgSessionId + ;
 
 //changing mapFrame href
 mapFrame.location.href = hrefMapa;
 
 
 Hope this helps.
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 9:57 AM
 To: mapguide-users@lists.osgeo.org
 Subject: Re: [mapguide-users] Create programmatically a map
 
 
 Hi Kenneth,
 I need again your help about my problem.
 
 I think the problem is that after new map run-time creation in library
 repository, I cannot use its map definition to create its web layout.
 
 How can I assign the new map to the layout?
 
 Thanks again, Fabio
 


 --
 
 
 Kenneth Skovhede, GEOGRAF A/S wrote:
 
 Try to look at the Maestro code:


http://trac.osgeo.org/mapguide/browser/trunk/Tools/Maestro/MaestroAPI/Lo
 calNativeConnection.cs#L182
 
 Hopefully you will find a small difference there.
 
 Regards, Kenneth Skovhede, GEOGRAF A/S
 
 
 
 sekko970 skrev:
 Yes, the OuterXml property contains the XML header line.
 Fabio




 --


 Kenneth Skovhede, GEOGRAF A/S wrote:
   
 Does the OuterXml property contain the ? version=1.0 
 encoding=utf-8 standalone=true ? line?

 Regards, Kenneth Skovhede, GEOGRAF A/S



 sekko970 skrev:
 
 Hi Kenneth, and thanks for your promptly reply.

 I had used an ancoding instance.

 Below, you can see my code to create the new map:

 Dim resID As New
 MgResourceIdentifier(Library://.../maps/MyMap.MapDefinition)

 Dim enc As New System.Text.UTF8Encoding(False)

 Dim newMapDef As New
 MgByteSource(enc.GetBytes(XMLMapTemplate.OuterXml),
 enc.GetByteCount(XMLMapTemplate.OuterXml))

 newMapDef.SetMimeType(MgMimeType.Xml)

 Dim resourceSrvc As MgResourceService =
 siteConn.CreateService(MgServiceType.ResourceService)

 resourceSrvc.SetResource(resID, newMapDef.GetReader(), Nothing)

 Dim map As New MgMap()

 map.Create(resourceSrvc, resID, MapName)

 ...

 Then, this is my code to create the map layout:

 Dim resID As New
 MgResourceIdentifier(Library://.../Layouts/MyMap.WebLayout)

 Dim enc As New System.Text.UTF8Encoding(False)

 Dim newLayoutDef As New
 MgByteSource(enc.GetBytes(XMLLayoutTemplate.OuterXml),
 enc.GetByteCount(XMLLayoutTemplate.OuterXml))

 newLayoutDef.SetMimeType(MgMimeType.Xml)

 resourceSrvc As MgResourceService =
 siteConn.CreateService(MgServiceType.ResourceService)

 resourceSrvc.SetResource(resID, newLayoutDef.GetReader(), Nothing)

 map.Save(resourceSrvc)


 Thanks for your help.
 Fabio




 --


 Kenneth Skovhede, GEOGRAF A/S wrote:
   
   
 You could have the problem that .Net emits an utf-8
 byte-order-marker 
 (BOM), when
 writing xml.
 http://en.wikipedia.org/wiki/Byte-order_mark

 To counter this, explicitly create an encoding instance:
 System.Text.Encoding enc = new System.Text.UTF8Encoding(false);

 Then implement a xml writer, or manually convert the xml to
bytes,
 using 
 the encoding.

 FYI, the MaestroAPI is LGPL, and so you may use it as a library,
 even 
 for commercial applications,
 and it handles this quirk and others.

 Regards, Kenneth Skovhede, GEOGRAF A/S



 sekko970 skrev:
 
 
 Dear all,

 I have created programmatically a map (and its layout) using MG
 .Net
 web
 API.
 After creation, the new map and layout are visible in MG
Maestro,
 and
 using
 the 'Show in browser button are correctly shown in browser

RE: [mapguide-users] Create programmatically a map

2009-02-18 Thread Ivan Milicevic
Can you write pseudo code of your task? What do you want to do? I need
little more information about your problem.

-Original Message-
From: mapguide-users-boun...@lists.osgeo.org
[mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
Sent: Wednesday, February 18, 2009 11:42 AM
To: mapguide-users@lists.osgeo.org
Subject: RE: [mapguide-users] Create programmatically a map


Hi Ivan,
below, you can see my code to create the new map: 

Dim resID As New
MgResourceIdentifier(Library://.../maps/MyMap.MapDefinition) 
Dim enc As New System.Text.UTF8Encoding(False) 
Dim newMapDef As New MgByteSource(enc.GetBytes(XMLMapTemplate.OuterXml),
enc.GetByteCount(XMLMapTemplate.OuterXml)) 
newMapDef.SetMimeType(MgMimeType.Xml) 
Dim resourceSrvc As MgResourceService =
siteConn.CreateService(MgServiceType.ResourceService) 
resourceSrvc.SetResource(resID, newMapDef.GetReader(), Nothing) 
Dim map As New MgMap() 
map.Create(resourceSrvc, resID, MapName) 

... 

Then, this is my code to create the map layout: 
Dim resID As New
MgResourceIdentifier(Library://.../Layouts/MyMap.WebLayout) 
Dim enc As New System.Text.UTF8Encoding(False) 
Dim newLayoutDef As New
MgByteSource(enc.GetBytes(XMLLayoutTemplate.OuterXml),
enc.GetByteCount(XMLLayoutTemplate.OuterXml)) 
newLayoutDef.SetMimeType(MgMimeType.Xml) 
resourceSrvc As MgResourceService =
siteConn.CreateService(MgServiceType.ResourceService) 
resourceSrvc.SetResource(resID, newLayoutDef.GetReader(), Nothing) 
map.Save(resourceSrvc) 

Perhaps between map and layout creation I should refresh the mapframe as
suggested from you?

Thanks in advance for your help.
Fabio


--


Ivan Milicevic wrote:
 
 Can you provide us code sample?
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 10:38 AM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 Hi Ivan,
 
 thanks for your suggestion, but my problem is not to refresh the
viewer
 to
 show the map just created, but is the correct creation of new map and
 layout.
 
 I think to have found the origin of my problem, but I don't understand
 the
 error:
 
 Argument is null. Exception occurred in method
 MgWebLayout.ParsePrintCommand
 at line 880 in file

c:\build_bond_area\bond_nightly\build_41.3\ent\os\web\src\webapp\WebLayo
 ut.cpp 
 
 Have you some idea?
 Thanks, Fabio
 


 --
 
 
 Ivan Milicevic wrote:
 
 Hello,
 
 You can change href of mapFrame. Here is sample code.
 
 var mapa = cijevi; //defines map name
 var stringMape = Library%3a%2f%2fPROJEKTI%2fSUPRANET%2fMAPE%2f +
 mapa;
 var hrefMapa =


http://172.21.10.3/mapguide/mapviewernet/mapframe.aspx?MAPDEFINITION=;
 + stringMape +


.MapDefinitionamp;TYPE=HTMLamp;SHOWLEGEND=0amp;SHOWPROP=0amp;INFOWI


DTH=0amp;LOCALE=enamp;HLTGT=1amp;HLTGTNAME=amp;SHOWSLIDER=0amp;SESS
 ION= + mgSessionId + ;
 
 //changing mapFrame href
 mapFrame.location.href = hrefMapa;
 
 
 Hope this helps.
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 9:57 AM
 To: mapguide-users@lists.osgeo.org
 Subject: Re: [mapguide-users] Create programmatically a map
 
 
 Hi Kenneth,
 I need again your help about my problem.
 
 I think the problem is that after new map run-time creation in
library
 repository, I cannot use its map definition to create its web layout.
 
 How can I assign the new map to the layout?
 
 Thanks again, Fabio
 



 --
 
 
 Kenneth Skovhede, GEOGRAF A/S wrote:
 
 Try to look at the Maestro code:



http://trac.osgeo.org/mapguide/browser/trunk/Tools/Maestro/MaestroAPI/Lo
 calNativeConnection.cs#L182
 
 Hopefully you will find a small difference there.
 
 Regards, Kenneth Skovhede, GEOGRAF A/S
 
 
 
 sekko970 skrev:
 Yes, the OuterXml property contains the XML header line.
 Fabio





 --


 Kenneth Skovhede, GEOGRAF A/S wrote:
   
 Does the OuterXml property contain the ? version=1.0 
 encoding=utf-8 standalone=true ? line?

 Regards, Kenneth Skovhede, GEOGRAF A/S



 sekko970 skrev:
 
 Hi Kenneth, and thanks for your promptly reply.

 I had used an ancoding instance.

 Below, you can see my code to create the new map:

 Dim resID As New
 MgResourceIdentifier(Library://.../maps/MyMap.MapDefinition)

 Dim enc As New System.Text.UTF8Encoding(False)

 Dim newMapDef As New
 MgByteSource(enc.GetBytes(XMLMapTemplate.OuterXml),
 enc.GetByteCount(XMLMapTemplate.OuterXml

RE: [mapguide-users] Create programmatically a map

2009-02-18 Thread sekko970

This is my problem:

I have created programmatically a map (and its layout) using MG .Net web
API. 
After creation, the new map and layout are visible in MG Maestro, and using
the 'Show in browser button are correctly shown in browser. 

The problem happens when I load the map directly from browser, and the
following error appears: 
 The type 'OSGeo.MapGuide.MgNullArgumentException' in assembly
'MapGuideDotNetApi, Version= 2.0.2.30 11, Culture=neutral,
PublicKeyToken=null' is not marked as serializable . 

Then, simply saving the new layout from MG Maestro (without any
modification), and reloading the map directly from browser, the error
disappears and the map is correctly shown. 

After saving the layout, there aren't differences in map and layout XML
definitions. 

Have you any idea about? 

--


Ivan Milicevic wrote:
 
 Can you write pseudo code of your task? What do you want to do? I need
 little more information about your problem.
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 11:42 AM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 Hi Ivan,
 below, you can see my code to create the new map: 
 
 Dim resID As New
 MgResourceIdentifier(Library://.../maps/MyMap.MapDefinition) 
 Dim enc As New System.Text.UTF8Encoding(False) 
 Dim newMapDef As New MgByteSource(enc.GetBytes(XMLMapTemplate.OuterXml),
 enc.GetByteCount(XMLMapTemplate.OuterXml)) 
 newMapDef.SetMimeType(MgMimeType.Xml) 
 Dim resourceSrvc As MgResourceService =
 siteConn.CreateService(MgServiceType.ResourceService) 
 resourceSrvc.SetResource(resID, newMapDef.GetReader(), Nothing) 
 Dim map As New MgMap() 
 map.Create(resourceSrvc, resID, MapName) 
 
 ... 
 
 Then, this is my code to create the map layout: 
 Dim resID As New
 MgResourceIdentifier(Library://.../Layouts/MyMap.WebLayout) 
 Dim enc As New System.Text.UTF8Encoding(False) 
 Dim newLayoutDef As New
 MgByteSource(enc.GetBytes(XMLLayoutTemplate.OuterXml),
 enc.GetByteCount(XMLLayoutTemplate.OuterXml)) 
 newLayoutDef.SetMimeType(MgMimeType.Xml) 
 resourceSrvc As MgResourceService =
 siteConn.CreateService(MgServiceType.ResourceService) 
 resourceSrvc.SetResource(resID, newLayoutDef.GetReader(), Nothing) 
 map.Save(resourceSrvc) 
 
 Perhaps between map and layout creation I should refresh the mapframe as
 suggested from you?
 
 Thanks in advance for your help.
 Fabio
 
 
 --
 
 
 Ivan Milicevic wrote:
 
 Can you provide us code sample?
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 10:38 AM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 Hi Ivan,
 
 thanks for your suggestion, but my problem is not to refresh the
 viewer
 to
 show the map just created, but is the correct creation of new map and
 layout.
 
 I think to have found the origin of my problem, but I don't understand
 the
 error:
 
 Argument is null. Exception occurred in method
 MgWebLayout.ParsePrintCommand
 at line 880 in file

 c:\build_bond_area\bond_nightly\build_41.3\ent\os\web\src\webapp\WebLayo
 ut.cpp 
 
 Have you some idea?
 Thanks, Fabio
 

 
 --
 
 
 Ivan Milicevic wrote:
 
 Hello,
 
 You can change href of mapFrame. Here is sample code.
 
 var mapa = cijevi; //defines map name
 var stringMape = Library%3a%2f%2fPROJEKTI%2fSUPRANET%2fMAPE%2f +
 mapa;
 var hrefMapa =


 http://172.21.10.3/mapguide/mapviewernet/mapframe.aspx?MAPDEFINITION=;
 + stringMape +


 .MapDefinitionamp;TYPE=HTMLamp;SHOWLEGEND=0amp;SHOWPROP=0amp;INFOWI


 DTH=0amp;LOCALE=enamp;HLTGT=1amp;HLTGTNAME=amp;SHOWSLIDER=0amp;SESS
 ION= + mgSessionId + ;
 
 //changing mapFrame href
 mapFrame.location.href = hrefMapa;
 
 
 Hope this helps.
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 9:57 AM
 To: mapguide-users@lists.osgeo.org
 Subject: Re: [mapguide-users] Create programmatically a map
 
 
 Hi Kenneth,
 I need again your help about my problem.
 
 I think the problem is that after new map run-time creation in
 library
 repository, I cannot use its map definition to create its web layout.
 
 How can I assign the new map to the layout?
 
 Thanks again, Fabio
 


 
 --
 
 
 Kenneth Skovhede, GEOGRAF A/S wrote:
 
 Try to look at the Maestro code:



 http

RE: [mapguide-users] Create programmatically a map

2009-02-18 Thread Ivan Milicevic
Please, before you open layout and map in Maestro go to:
http://localhost/mapguide/mapagent/index.html - go to
Resource--GetResourceContent-- and type correct resource ID on right
side. See is there any strange things in output XML file. Compare it
after saving it in Maestro.

-Original Message-
From: mapguide-users-boun...@lists.osgeo.org
[mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
Sent: Wednesday, February 18, 2009 12:05 PM
To: mapguide-users@lists.osgeo.org
Subject: RE: [mapguide-users] Create programmatically a map


This is my problem:

I have created programmatically a map (and its layout) using MG .Net web
API. 
After creation, the new map and layout are visible in MG Maestro, and
using
the 'Show in browser button are correctly shown in browser. 

The problem happens when I load the map directly from browser, and the
following error appears: 
 The type 'OSGeo.MapGuide.MgNullArgumentException' in assembly
'MapGuideDotNetApi, Version= 2.0.2.30 11, Culture=neutral,
PublicKeyToken=null' is not marked as serializable . 

Then, simply saving the new layout from MG Maestro (without any
modification), and reloading the map directly from browser, the error
disappears and the map is correctly shown. 

After saving the layout, there aren't differences in map and layout XML
definitions. 

Have you any idea about? 


--


Ivan Milicevic wrote:
 
 Can you write pseudo code of your task? What do you want to do? I need
 little more information about your problem.
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 11:42 AM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 Hi Ivan,
 below, you can see my code to create the new map: 
 
 Dim resID As New
 MgResourceIdentifier(Library://.../maps/MyMap.MapDefinition) 
 Dim enc As New System.Text.UTF8Encoding(False) 
 Dim newMapDef As New
MgByteSource(enc.GetBytes(XMLMapTemplate.OuterXml),
 enc.GetByteCount(XMLMapTemplate.OuterXml)) 
 newMapDef.SetMimeType(MgMimeType.Xml) 
 Dim resourceSrvc As MgResourceService =
 siteConn.CreateService(MgServiceType.ResourceService) 
 resourceSrvc.SetResource(resID, newMapDef.GetReader(), Nothing) 
 Dim map As New MgMap() 
 map.Create(resourceSrvc, resID, MapName) 
 
 ... 
 
 Then, this is my code to create the map layout: 
 Dim resID As New
 MgResourceIdentifier(Library://.../Layouts/MyMap.WebLayout) 
 Dim enc As New System.Text.UTF8Encoding(False) 
 Dim newLayoutDef As New
 MgByteSource(enc.GetBytes(XMLLayoutTemplate.OuterXml),
 enc.GetByteCount(XMLLayoutTemplate.OuterXml)) 
 newLayoutDef.SetMimeType(MgMimeType.Xml) 
 resourceSrvc As MgResourceService =
 siteConn.CreateService(MgServiceType.ResourceService) 
 resourceSrvc.SetResource(resID, newLayoutDef.GetReader(), Nothing) 
 map.Save(resourceSrvc) 
 
 Perhaps between map and layout creation I should refresh the mapframe
as
 suggested from you?
 
 Thanks in advance for your help.
 Fabio
 


 --
 
 
 Ivan Milicevic wrote:
 
 Can you provide us code sample?
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 10:38 AM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 Hi Ivan,
 
 thanks for your suggestion, but my problem is not to refresh the
 viewer
 to
 show the map just created, but is the correct creation of new map and
 layout.
 
 I think to have found the origin of my problem, but I don't
understand
 the
 error:
 
 Argument is null. Exception occurred in method
 MgWebLayout.ParsePrintCommand
 at line 880 in file


c:\build_bond_area\bond_nightly\build_41.3\ent\os\web\src\webapp\WebLayo
 ut.cpp 
 
 Have you some idea?
 Thanks, Fabio
 



 --
 
 
 Ivan Milicevic wrote:
 
 Hello,
 
 You can change href of mapFrame. Here is sample code.
 
 var mapa = cijevi; //defines map name
 var stringMape = Library%3a%2f%2fPROJEKTI%2fSUPRANET%2fMAPE%2f +
 mapa;
 var hrefMapa =



http://172.21.10.3/mapguide/mapviewernet/mapframe.aspx?MAPDEFINITION=;
 + stringMape +



.MapDefinitionamp;TYPE=HTMLamp;SHOWLEGEND=0amp;SHOWPROP=0amp;INFOWI



DTH=0amp;LOCALE=enamp;HLTGT=1amp;HLTGTNAME=amp;SHOWSLIDER=0amp;SESS
 ION= + mgSessionId + ;
 
 //changing mapFrame href
 mapFrame.location.href = hrefMapa;
 
 
 Hope this helps.
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of
sekko970
 Sent: Wednesday, February 18, 2009 9:57 AM

RE: [mapguide-users] Create programmatically a map

2009-02-18 Thread sekko970

Below you can see the new map and layout XML created from
http://localhost/mapguide/mapagent/index.html before and after the saving
from Maestro (is equals for both).

  ?xml version=1.0 encoding=UTF-8 ? 
- ResourceList xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:noNamespaceSchemaLocation=ResourceList-1.0.0.xsd
- ResourceDocument
  ResourceIdLibrary://.../newMap.MapDefinition/ResourceId 
  Depth3/Depth 
  OwnerAdministrator/Owner 
  CreatedDate2009-02-18T11:31:29Z/CreatedDate 
  ModifiedDate2009-02-18T11:31:29Z/ModifiedDate 
- ResourceDocumentHeader
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:noNamespaceSchemaLocation=ResourceDocumentHeader-1.0.0.xsd
- Security xsi:noNamespaceSchemaLocation=ResourceSecurity-1.0.0.xsd
  Inheritedtrue/Inherited 
- Groups
- Group
  NameEveryone/Name 
  Permissionsr,w/Permissions 
  /Group
  /Groups
  /Security
  /ResourceDocumentHeader
  /ResourceDocument
  /ResourceList



  ?xml version=1.0 encoding=UTF-8 ? 
- ResourceList xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:noNamespaceSchemaLocation=ResourceList-1.0.0.xsd
- ResourceDocument
  ResourceIdLibrary://.../newLayout.WebLayout/ResourceId 
  Depth3/Depth 
  OwnerAdministrator/Owner 
  CreatedDate2009-02-18T11:35:51Z/CreatedDate 
  ModifiedDate2009-02-18T11:36:32Z/ModifiedDate 
- ResourceDocumentHeader
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:noNamespaceSchemaLocation=ResourceDocumentHeader-1.0.0.xsd
- Security xsi:noNamespaceSchemaLocation=ResourceSecurity-1.0.0.xsd
  Inheritedtrue/Inherited 
- Groups
- Group
  NameEveryone/Name 
  Permissionsr,w/Permissions 
  /Group
  /Groups
  /Security
  /ResourceDocumentHeader
  /ResourceDocument
  /ResourceList


--


Ivan Milicevic wrote:
 
 Please, before you open layout and map in Maestro go to:
 http://localhost/mapguide/mapagent/index.html - go to
 Resource--GetResourceContent-- and type correct resource ID on right
 side. See is there any strange things in output XML file. Compare it
 after saving it in Maestro.
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 12:05 PM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 This is my problem:
 
 I have created programmatically a map (and its layout) using MG .Net web
 API. 
 After creation, the new map and layout are visible in MG Maestro, and
 using
 the 'Show in browser button are correctly shown in browser. 
 
 The problem happens when I load the map directly from browser, and the
 following error appears: 
  The type 'OSGeo.MapGuide.MgNullArgumentException' in assembly
 'MapGuideDotNetApi, Version= 2.0.2.30 11, Culture=neutral,
 PublicKeyToken=null' is not marked as serializable . 
 
 Then, simply saving the new layout from MG Maestro (without any
 modification), and reloading the map directly from browser, the error
 disappears and the map is correctly shown. 
 
 After saving the layout, there aren't differences in map and layout XML
 definitions. 
 
 Have you any idea about? 
 
 
 --
 
 
 Ivan Milicevic wrote:
 
 Can you write pseudo code of your task? What do you want to do? I need
 little more information about your problem.
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 11:42 AM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 Hi Ivan,
 below, you can see my code to create the new map: 
 
 Dim resID As New
 MgResourceIdentifier(Library://.../maps/MyMap.MapDefinition) 
 Dim enc As New System.Text.UTF8Encoding(False) 
 Dim newMapDef As New
 MgByteSource(enc.GetBytes(XMLMapTemplate.OuterXml),
 enc.GetByteCount(XMLMapTemplate.OuterXml)) 
 newMapDef.SetMimeType(MgMimeType.Xml) 
 Dim resourceSrvc As MgResourceService =
 siteConn.CreateService(MgServiceType.ResourceService) 
 resourceSrvc.SetResource(resID, newMapDef.GetReader(), Nothing) 
 Dim map As New MgMap() 
 map.Create(resourceSrvc, resID, MapName) 
 
 ... 
 
 Then, this is my code to create the map layout: 
 Dim resID As New
 MgResourceIdentifier(Library://.../Layouts/MyMap.WebLayout) 
 Dim enc As New System.Text.UTF8Encoding(False) 
 Dim newLayoutDef As New
 MgByteSource(enc.GetBytes(XMLLayoutTemplate.OuterXml),
 enc.GetByteCount(XMLLayoutTemplate.OuterXml)) 
 newLayoutDef.SetMimeType(MgMimeType.Xml) 
 resourceSrvc As MgResourceService =
 siteConn.CreateService(MgServiceType.ResourceService) 
 resourceSrvc.SetResource(resID, newLayoutDef.GetReader(), Nothing) 
 map.Save(resourceSrvc) 
 
 Perhaps between map and layout creation I should refresh

RE: [mapguide-users] Create programmatically a map

2009-02-18 Thread Ivan Milicevic
Very interesting... Can you check mapguide error log? Is there any
records related with this problem?

-Original Message-
From: mapguide-users-boun...@lists.osgeo.org
[mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
Sent: Wednesday, February 18, 2009 12:41 PM
To: mapguide-users@lists.osgeo.org
Subject: RE: [mapguide-users] Create programmatically a map


Below you can see the new map and layout XML created from
http://localhost/mapguide/mapagent/index.html before and after the
saving
from Maestro (is equals for both).

  ?xml version=1.0 encoding=UTF-8 ? 
- ResourceList xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:noNamespaceSchemaLocation=ResourceList-1.0.0.xsd
- ResourceDocument
  ResourceIdLibrary://.../newMap.MapDefinition/ResourceId 
  Depth3/Depth 
  OwnerAdministrator/Owner 
  CreatedDate2009-02-18T11:31:29Z/CreatedDate 
  ModifiedDate2009-02-18T11:31:29Z/ModifiedDate 
- ResourceDocumentHeader
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:noNamespaceSchemaLocation=ResourceDocumentHeader-1.0.0.xsd
- Security xsi:noNamespaceSchemaLocation=ResourceSecurity-1.0.0.xsd
  Inheritedtrue/Inherited 
- Groups
- Group
  NameEveryone/Name 
  Permissionsr,w/Permissions 
  /Group
  /Groups
  /Security
  /ResourceDocumentHeader
  /ResourceDocument
  /ResourceList



  ?xml version=1.0 encoding=UTF-8 ? 
- ResourceList xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:noNamespaceSchemaLocation=ResourceList-1.0.0.xsd
- ResourceDocument
  ResourceIdLibrary://.../newLayout.WebLayout/ResourceId 
  Depth3/Depth 
  OwnerAdministrator/Owner 
  CreatedDate2009-02-18T11:35:51Z/CreatedDate 
  ModifiedDate2009-02-18T11:36:32Z/ModifiedDate 
- ResourceDocumentHeader
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:noNamespaceSchemaLocation=ResourceDocumentHeader-1.0.0.xsd
- Security xsi:noNamespaceSchemaLocation=ResourceSecurity-1.0.0.xsd
  Inheritedtrue/Inherited 
- Groups
- Group
  NameEveryone/Name 
  Permissionsr,w/Permissions 
  /Group
  /Groups
  /Security
  /ResourceDocumentHeader
  /ResourceDocument
  /ResourceList



--


Ivan Milicevic wrote:
 
 Please, before you open layout and map in Maestro go to:
 http://localhost/mapguide/mapagent/index.html - go to
 Resource--GetResourceContent-- and type correct resource ID on right
 side. See is there any strange things in output XML file. Compare it
 after saving it in Maestro.
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 12:05 PM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 This is my problem:
 
 I have created programmatically a map (and its layout) using MG .Net
web
 API. 
 After creation, the new map and layout are visible in MG Maestro, and
 using
 the 'Show in browser button are correctly shown in browser. 
 
 The problem happens when I load the map directly from browser, and the
 following error appears: 
  The type 'OSGeo.MapGuide.MgNullArgumentException' in assembly
 'MapGuideDotNetApi, Version= 2.0.2.30 11, Culture=neutral,
 PublicKeyToken=null' is not marked as serializable . 
 
 Then, simply saving the new layout from MG Maestro (without any
 modification), and reloading the map directly from browser, the error
 disappears and the map is correctly shown. 
 
 After saving the layout, there aren't differences in map and layout
XML
 definitions. 
 
 Have you any idea about? 
 


 --
 
 
 Ivan Milicevic wrote:
 
 Can you write pseudo code of your task? What do you want to do? I
need
 little more information about your problem.
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 11:42 AM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 Hi Ivan,
 below, you can see my code to create the new map: 
 
 Dim resID As New
 MgResourceIdentifier(Library://.../maps/MyMap.MapDefinition) 
 Dim enc As New System.Text.UTF8Encoding(False) 
 Dim newMapDef As New
 MgByteSource(enc.GetBytes(XMLMapTemplate.OuterXml),
 enc.GetByteCount(XMLMapTemplate.OuterXml)) 
 newMapDef.SetMimeType(MgMimeType.Xml) 
 Dim resourceSrvc As MgResourceService =
 siteConn.CreateService(MgServiceType.ResourceService) 
 resourceSrvc.SetResource(resID, newMapDef.GetReader(), Nothing) 
 Dim map As New MgMap() 
 map.Create(resourceSrvc, resID, MapName) 
 
 ... 
 
 Then, this is my code to create the map layout: 
 Dim resID As New
 MgResourceIdentifier(Library://.../Layouts/MyMap.WebLayout) 
 Dim enc As New System.Text.UTF8Encoding(False) 
 Dim newLayoutDef As New
 MgByteSource

RE: [mapguide-users] Create programmatically a map

2009-02-18 Thread sekko970

Sure, this is the related record in error log:

2009-02-18T12:07:11   Administrator
 Error: Resource was not found:
Session:36fb9200--1000-8000-000bcd727323_en_7F010AFC0AFB0AFA//new.Map
 StackTrace:
  - MgResourceServiceHandler.ProcessOperation line 80 file
d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services\resource\ResourceServiceHandler.cpp
  - MgOpGetResourceData.Execute line 124 file
d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services\resource\OpGetResourceData.cpp
  - MgServerResourceService.GetResourceData line 1401 file
d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services\resource\ServerResourceService.cpp
  - MgApplicationRepositoryManager.GetResourceData line 1201 file
d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services\resource\ApplicationRepositoryManager.cpp
  - MgResourceContentManager.GetDocument line 590 file
d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services\resource\ResourceContentManager.cpp
  - MgResourceDefinitionManager.GetDocument line 476 file
d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services\resource\ResourceDefinitionManager.cpp
Resource was not found:
Session:36fb9200--1000-8000-000bcd727323_en_7F010AFC0AFB0AFA//new.Map

--


Ivan Milicevic wrote:
 
 Very interesting... Can you check mapguide error log? Is there any
 records related with this problem?
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 12:41 PM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 Below you can see the new map and layout XML created from
 http://localhost/mapguide/mapagent/index.html before and after the
 saving
 from Maestro (is equals for both).
 
   ?xml version=1.0 encoding=UTF-8 ? 
 - ResourceList xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:noNamespaceSchemaLocation=ResourceList-1.0.0.xsd
 - ResourceDocument
   ResourceIdLibrary://.../newMap.MapDefinition/ResourceId 
   Depth3/Depth 
   OwnerAdministrator/Owner 
   CreatedDate2009-02-18T11:31:29Z/CreatedDate 
   ModifiedDate2009-02-18T11:31:29Z/ModifiedDate 
 - ResourceDocumentHeader
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:noNamespaceSchemaLocation=ResourceDocumentHeader-1.0.0.xsd
 - Security xsi:noNamespaceSchemaLocation=ResourceSecurity-1.0.0.xsd
   Inheritedtrue/Inherited 
 - Groups
 - Group
   NameEveryone/Name 
   Permissionsr,w/Permissions 
   /Group
   /Groups
   /Security
   /ResourceDocumentHeader
   /ResourceDocument
   /ResourceList
 
 
 
   ?xml version=1.0 encoding=UTF-8 ? 
 - ResourceList xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:noNamespaceSchemaLocation=ResourceList-1.0.0.xsd
 - ResourceDocument
   ResourceIdLibrary://.../newLayout.WebLayout/ResourceId 
   Depth3/Depth 
   OwnerAdministrator/Owner 
   CreatedDate2009-02-18T11:35:51Z/CreatedDate 
   ModifiedDate2009-02-18T11:36:32Z/ModifiedDate 
 - ResourceDocumentHeader
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:noNamespaceSchemaLocation=ResourceDocumentHeader-1.0.0.xsd
 - Security xsi:noNamespaceSchemaLocation=ResourceSecurity-1.0.0.xsd
   Inheritedtrue/Inherited 
 - Groups
 - Group
   NameEveryone/Name 
   Permissionsr,w/Permissions 
   /Group
   /Groups
   /Security
   /ResourceDocumentHeader
   /ResourceDocument
   /ResourceList
 
 
 
 --
 
 
 Ivan Milicevic wrote:
 
 Please, before you open layout and map in Maestro go to:
 http://localhost/mapguide/mapagent/index.html - go to
 Resource--GetResourceContent-- and type correct resource ID on right
 side. See is there any strange things in output XML file. Compare it
 after saving it in Maestro.
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 12:05 PM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 This is my problem:
 
 I have created programmatically a map (and its layout) using MG .Net
 web
 API. 
 After creation, the new map and layout are visible in MG Maestro, and
 using
 the 'Show in browser button are correctly shown in browser. 
 
 The problem happens when I load the map directly from browser, and the
 following error appears: 
  The type 'OSGeo.MapGuide.MgNullArgumentException' in assembly
 'MapGuideDotNetApi, Version= 2.0.2.30 11, Culture=neutral,
 PublicKeyToken=null' is not marked as serializable . 
 
 Then, simply saving the new layout from MG Maestro (without any
 modification), and reloading the map directly from browser

RE: [mapguide-users] Create programmatically a map

2009-02-18 Thread sekko970

Each try is failed for the following error: 'Invalid resource type'.

Dim resID As New MgResourceIdentifier(Librarry://.../  MyLayout  . 
MgResourceType.WebLayout)
Dim enc As New System.Text.UTF8Encoding(False)
Dim newLayoutDef As New MgByteSource(enc.GetBytes(newLayoutXML.OuterXml),
enc.GetByteCount(newLayoutXML.OuterXml))
newLayoutDef.SetMimeType(MgMimeType.Xml)
resourceSrvc.SetResource(resID, newLayoutDef.GetReader(), Nothing)
map.Save(resourceSrvc)
resourceSrvc.UpdateRepository(resID, newLayoutDef.GetReader(), Nothing)

--


Ivan Milicevic wrote:
 
 I'm guessing that you must update repository after creating new layout.
 Look at
 http://mapguide.osgeo.org/files/mapguide/docs/2.0/d8/de1/class_mg_resour
 ce_service_e0294dc308ecc4708b79d493086f210b.htm
 
 
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 2:01 PM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 Sure, this is the related record in error log:
 
 2009-02-18T12:07:11 Administrator
  Error: Resource was not found:
 Session:36fb9200--1000-8000-000bcd727323_en_7F010AFC0AFB0AFA//ne
 w.Map
  StackTrace:
   - MgResourceServiceHandler.ProcessOperation line 80 file
 d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\ResourceServiceHandler.cpp
   - MgOpGetResourceData.Execute line 124 file
 d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\OpGetResourceData.cpp
   - MgServerResourceService.GetResourceData line 1401 file
 d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\ServerResourceService.cpp
   - MgApplicationRepositoryManager.GetResourceData line 1201 file
 d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\ApplicationRepositoryManager.cpp
   - MgResourceContentManager.GetDocument line 590 file
 d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\ResourceContentManager.cpp
   - MgResourceDefinitionManager.GetDocument line 476 file
 d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\ResourceDefinitionManager.cpp
 Resource was not found:
 Session:36fb9200--1000-8000-000bcd727323_en_7F010AFC0AFB0AFA//ne
 w.Map
 
 
 --
 
 
 Ivan Milicevic wrote:
 
 Very interesting... Can you check mapguide error log? Is there any
 records related with this problem?
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 12:41 PM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 Below you can see the new map and layout XML created from
 http://localhost/mapguide/mapagent/index.html before and after the
 saving
 from Maestro (is equals for both).
 
   ?xml version=1.0 encoding=UTF-8 ? 
 - ResourceList xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:noNamespaceSchemaLocation=ResourceList-1.0.0.xsd
 - ResourceDocument
   ResourceIdLibrary://.../newMap.MapDefinition/ResourceId 
   Depth3/Depth 
   OwnerAdministrator/Owner 
   CreatedDate2009-02-18T11:31:29Z/CreatedDate 
   ModifiedDate2009-02-18T11:31:29Z/ModifiedDate 
 - ResourceDocumentHeader
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:noNamespaceSchemaLocation=ResourceDocumentHeader-1.0.0.xsd
 - Security
 xsi:noNamespaceSchemaLocation=ResourceSecurity-1.0.0.xsd
   Inheritedtrue/Inherited 
 - Groups
 - Group
   NameEveryone/Name 
   Permissionsr,w/Permissions 
   /Group
   /Groups
   /Security
   /ResourceDocumentHeader
   /ResourceDocument
   /ResourceList
 
 
 
   ?xml version=1.0 encoding=UTF-8 ? 
 - ResourceList xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:noNamespaceSchemaLocation=ResourceList-1.0.0.xsd
 - ResourceDocument
   ResourceIdLibrary://.../newLayout.WebLayout/ResourceId 
   Depth3/Depth 
   OwnerAdministrator/Owner 
   CreatedDate2009-02-18T11:35:51Z/CreatedDate 
   ModifiedDate2009-02-18T11:36:32Z/ModifiedDate 
 - ResourceDocumentHeader
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:noNamespaceSchemaLocation=ResourceDocumentHeader-1.0.0.xsd
 - Security
 xsi:noNamespaceSchemaLocation=ResourceSecurity-1.0.0.xsd
   Inheritedtrue/Inherited 
 - Groups
 - Group
   NameEveryone/Name 
   Permissionsr,w/Permissions 
   /Group
   /Groups
   /Security
   /ResourceDocumentHeader
   /ResourceDocument
   /ResourceList
 
 

 
 --
 
 
 Ivan Milicevic wrote:
 
 Please, before you

RE: [mapguide-users] Create programmatically a map

2009-02-18 Thread Ivan Milicevic
Is it double r in resID copy/paste error?

-Original Message-
From: mapguide-users-boun...@lists.osgeo.org
[mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
Sent: Wednesday, February 18, 2009 3:20 PM
To: mapguide-users@lists.osgeo.org
Subject: RE: [mapguide-users] Create programmatically a map


Each try is failed for the following error: 'Invalid resource type'.

Dim resID As New MgResourceIdentifier(Librarry://.../  MyLayout  .

MgResourceType.WebLayout)
Dim enc As New System.Text.UTF8Encoding(False)
Dim newLayoutDef As New
MgByteSource(enc.GetBytes(newLayoutXML.OuterXml),
enc.GetByteCount(newLayoutXML.OuterXml))
newLayoutDef.SetMimeType(MgMimeType.Xml)
resourceSrvc.SetResource(resID, newLayoutDef.GetReader(), Nothing)
map.Save(resourceSrvc)
resourceSrvc.UpdateRepository(resID, newLayoutDef.GetReader(), Nothing)


--


Ivan Milicevic wrote:
 
 I'm guessing that you must update repository after creating new
layout.
 Look at

http://mapguide.osgeo.org/files/mapguide/docs/2.0/d8/de1/class_mg_resour
 ce_service_e0294dc308ecc4708b79d493086f210b.htm
 
 
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 2:01 PM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 Sure, this is the related record in error log:
 
 2009-02-18T12:07:11 Administrator
  Error: Resource was not found:

Session:36fb9200--1000-8000-000bcd727323_en_7F010AFC0AFB0AFA//ne
 w.Map
  StackTrace:
   - MgResourceServiceHandler.ProcessOperation line 80 file

d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\ResourceServiceHandler.cpp
   - MgOpGetResourceData.Execute line 124 file

d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\OpGetResourceData.cpp
   - MgServerResourceService.GetResourceData line 1401 file

d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\ServerResourceService.cpp
   - MgApplicationRepositoryManager.GetResourceData line 1201 file

d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\ApplicationRepositoryManager.cpp
   - MgResourceContentManager.GetDocument line 590 file

d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\ResourceContentManager.cpp
   - MgResourceDefinitionManager.GetDocument line 476 file

d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\ResourceDefinitionManager.cpp
 Resource was not found:

Session:36fb9200--1000-8000-000bcd727323_en_7F010AFC0AFB0AFA//ne
 w.Map
 


 --
 
 
 Ivan Milicevic wrote:
 
 Very interesting... Can you check mapguide error log? Is there any
 records related with this problem?
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 12:41 PM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 Below you can see the new map and layout XML created from
 http://localhost/mapguide/mapagent/index.html before and after the
 saving
 from Maestro (is equals for both).
 
   ?xml version=1.0 encoding=UTF-8 ? 
 - ResourceList xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:noNamespaceSchemaLocation=ResourceList-1.0.0.xsd
 - ResourceDocument
   ResourceIdLibrary://.../newMap.MapDefinition/ResourceId 
   Depth3/Depth 
   OwnerAdministrator/Owner 
   CreatedDate2009-02-18T11:31:29Z/CreatedDate 
   ModifiedDate2009-02-18T11:31:29Z/ModifiedDate 
 - ResourceDocumentHeader
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:noNamespaceSchemaLocation=ResourceDocumentHeader-1.0.0.xsd
 - Security
 xsi:noNamespaceSchemaLocation=ResourceSecurity-1.0.0.xsd
   Inheritedtrue/Inherited 
 - Groups
 - Group
   NameEveryone/Name 
   Permissionsr,w/Permissions 
   /Group
   /Groups
   /Security
   /ResourceDocumentHeader
   /ResourceDocument
   /ResourceList
 
 
 
   ?xml version=1.0 encoding=UTF-8 ? 
 - ResourceList xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:noNamespaceSchemaLocation=ResourceList-1.0.0.xsd
 - ResourceDocument
   ResourceIdLibrary://.../newLayout.WebLayout/ResourceId 
   Depth3/Depth 
   OwnerAdministrator/Owner 
   CreatedDate2009-02-18T11:35:51Z/CreatedDate 
   ModifiedDate2009-02-18T11:36:32Z/ModifiedDate 
 - ResourceDocumentHeader
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:noNamespaceSchemaLocation=ResourceDocumentHeader-1.0.0.xsd
 - Security
 xsi:noNamespaceSchemaLocation=ResourceSecurity-1.0.0.xsd
   Inheritedtrue/Inherited

RE: [mapguide-users] Create programmatically a map

2009-02-18 Thread Ivan Milicevic
Hm... Try pass byteReader object instead of newLayoutDef.GetReader().




PHP SAMPLE:
// Get a resource identifier for the library
 $resourceID = new MgResourceIdentifier('Library://');
 // Read the new content from a file
 $byteSource = new MgByteSource('C:\Data\Repository\Content.xml');
 // Put that MgByteSource into an MgByteReader
 $byteReader = $byteSource-GetReader();
 // Update the repository content
 $resourceService-UpdateRepository($resourceID, $byteReader, null);


-Original Message-
From: mapguide-users-boun...@lists.osgeo.org
[mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
Sent: Wednesday, February 18, 2009 3:28 PM
To: mapguide-users@lists.osgeo.org
Subject: RE: [mapguide-users] Create programmatically a map


I'm sorry Ivan, is a copy/paste error!



Ivan Milicevic wrote:
 
 Is it double r in resID copy/paste error?
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 3:20 PM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 Each try is failed for the following error: 'Invalid resource type'.
 
 Dim resID As New MgResourceIdentifier(Librarry://.../  MyLayout 
.
 
 MgResourceType.WebLayout)
 Dim enc As New System.Text.UTF8Encoding(False)
 Dim newLayoutDef As New
 MgByteSource(enc.GetBytes(newLayoutXML.OuterXml),
 enc.GetByteCount(newLayoutXML.OuterXml))
 newLayoutDef.SetMimeType(MgMimeType.Xml)
 resourceSrvc.SetResource(resID, newLayoutDef.GetReader(), Nothing)
 map.Save(resourceSrvc)
 resourceSrvc.UpdateRepository(resID, newLayoutDef.GetReader(),
Nothing)
 


 --
 
 
 Ivan Milicevic wrote:
 
 I'm guessing that you must update repository after creating new
 layout.
 Look at


http://mapguide.osgeo.org/files/mapguide/docs/2.0/d8/de1/class_mg_resour
 ce_service_e0294dc308ecc4708b79d493086f210b.htm
 
 
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 2:01 PM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 Sure, this is the related record in error log:
 
 2009-02-18T12:07:11Administrator
  Error: Resource was not found:


Session:36fb9200--1000-8000-000bcd727323_en_7F010AFC0AFB0AFA//ne
 w.Map
  StackTrace:
   - MgResourceServiceHandler.ProcessOperation line 80 file


d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\ResourceServiceHandler.cpp
   - MgOpGetResourceData.Execute line 124 file


d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\OpGetResourceData.cpp
   - MgServerResourceService.GetResourceData line 1401 file


d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\ServerResourceService.cpp
   - MgApplicationRepositoryManager.GetResourceData line 1201 file


d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\ApplicationRepositoryManager.cpp
   - MgResourceContentManager.GetDocument line 590 file


d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\ResourceContentManager.cpp
   - MgResourceDefinitionManager.GetDocument line 476 file


d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\ResourceDefinitionManager.cpp
 Resource was not found:


Session:36fb9200--1000-8000-000bcd727323_en_7F010AFC0AFB0AFA//ne
 w.Map
 



 --
 
 
 Ivan Milicevic wrote:
 
 Very interesting... Can you check mapguide error log? Is there any
 records related with this problem?
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of
sekko970
 Sent: Wednesday, February 18, 2009 12:41 PM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 Below you can see the new map and layout XML created from
 http://localhost/mapguide/mapagent/index.html before and after the
 saving
 from Maestro (is equals for both).
 
   ?xml version=1.0 encoding=UTF-8 ? 
 - ResourceList
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:noNamespaceSchemaLocation=ResourceList-1.0.0.xsd
 - ResourceDocument
   ResourceIdLibrary://.../newMap.MapDefinition/ResourceId 
   Depth3/Depth 
   OwnerAdministrator/Owner 
   CreatedDate2009-02-18T11:31:29Z/CreatedDate 
   ModifiedDate2009-02-18T11:31:29Z/ModifiedDate 
 - ResourceDocumentHeader
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:noNamespaceSchemaLocation=ResourceDocumentHeader-1.0.0.xsd
 - Security

Re: [mapguide-users] Create programmatically a map

2009-02-18 Thread Kenneth Skovhede, GEOGRAF A/S

Just to be sure...

The xml you posted is the ResourceHeader, and not the ResourceContent, 
so it does not really show what the problem may be.
The error from the log states that the runtime map is not created, which 
is strange because a WebLayout cannot reference a runtime map.
The other error you posted seemed to indicate that the Print command was 
invalid inside the WebLayout.


Can you try so save the xml, just before you write it to the MgByteStream?
Then try to post the file, using the SetResource in the webform 
mentioned earlier.
If you get the same error, try to post the file somewhere, and provide a 
link.

Be carefull not to copy/paste, but post the actual file.

Btw. how large is the file? larger than 8K?

Regards, Kenneth Skovhede, GEOGRAF A/S



___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users


RE: [mapguide-users] Create programmatically a map

2009-02-18 Thread sekko970

Tryed, but no changes.

--


Ivan Milicevic wrote:
 
 Hm... Try pass byteReader object instead of newLayoutDef.GetReader().
 
 
 
 
 PHP SAMPLE:
 // Get a resource identifier for the library
  $resourceID = new MgResourceIdentifier('Library://');
  // Read the new content from a file
  $byteSource = new MgByteSource('C:\Data\Repository\Content.xml');
  // Put that MgByteSource into an MgByteReader
  $byteReader = $byteSource-GetReader();
  // Update the repository content
  $resourceService-UpdateRepository($resourceID, $byteReader, null);
 
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 3:28 PM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 I'm sorry Ivan, is a copy/paste error!
 
 
 
 Ivan Milicevic wrote:
 
 Is it double r in resID copy/paste error?
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 3:20 PM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 Each try is failed for the following error: 'Invalid resource type'.
 
 Dim resID As New MgResourceIdentifier(Librarry://.../  MyLayout 
 .
 
 MgResourceType.WebLayout)
 Dim enc As New System.Text.UTF8Encoding(False)
 Dim newLayoutDef As New
 MgByteSource(enc.GetBytes(newLayoutXML.OuterXml),
 enc.GetByteCount(newLayoutXML.OuterXml))
 newLayoutDef.SetMimeType(MgMimeType.Xml)
 resourceSrvc.SetResource(resID, newLayoutDef.GetReader(), Nothing)
 map.Save(resourceSrvc)
 resourceSrvc.UpdateRepository(resID, newLayoutDef.GetReader(),
 Nothing)
 

 
 --
 
 
 Ivan Milicevic wrote:
 
 I'm guessing that you must update repository after creating new
 layout.
 Look at


 http://mapguide.osgeo.org/files/mapguide/docs/2.0/d8/de1/class_mg_resour
 ce_service_e0294dc308ecc4708b79d493086f210b.htm
 
 
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of sekko970
 Sent: Wednesday, February 18, 2009 2:01 PM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 Sure, this is the related record in error log:
 
 2009-02-18T12:07:11   Administrator
  Error: Resource was not found:


 Session:36fb9200--1000-8000-000bcd727323_en_7F010AFC0AFB0AFA//ne
 w.Map
  StackTrace:
   - MgResourceServiceHandler.ProcessOperation line 80 file


 d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\ResourceServiceHandler.cpp
   - MgOpGetResourceData.Execute line 124 file


 d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\OpGetResourceData.cpp
   - MgServerResourceService.GetResourceData line 1401 file


 d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\ServerResourceService.cpp
   - MgApplicationRepositoryManager.GetResourceData line 1201 file


 d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\ApplicationRepositoryManager.cpp
   - MgResourceContentManager.GetDocument line 590 file


 d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\ResourceContentManager.cpp
   - MgResourceDefinitionManager.GetDocument line 476 file


 d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services
 \resource\ResourceDefinitionManager.cpp
 Resource was not found:


 Session:36fb9200--1000-8000-000bcd727323_en_7F010AFC0AFB0AFA//ne
 w.Map
 


 
 --
 
 
 Ivan Milicevic wrote:
 
 Very interesting... Can you check mapguide error log? Is there any
 records related with this problem?
 
 -Original Message-
 From: mapguide-users-boun...@lists.osgeo.org
 [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of
 sekko970
 Sent: Wednesday, February 18, 2009 12:41 PM
 To: mapguide-users@lists.osgeo.org
 Subject: RE: [mapguide-users] Create programmatically a map
 
 
 Below you can see the new map and layout XML created from
 http://localhost/mapguide/mapagent/index.html before and after the
 saving
 from Maestro (is equals for both).
 
   ?xml version=1.0 encoding=UTF-8 ? 
 - ResourceList
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:noNamespaceSchemaLocation=ResourceList-1.0.0.xsd
 - ResourceDocument
   ResourceIdLibrary://.../newMap.MapDefinition/ResourceId 
   Depth3/Depth 
   OwnerAdministrator/Owner 
   CreatedDate2009-02-18T11:31:29Z/CreatedDate 
   ModifiedDate2009-02-18T11:31:29Z

Re: [mapguide-users] Create programmatically a map

2009-02-18 Thread sekko970

The file is 21K.
I tryed also to load it directly from Maestro, and I have had no problem.

--


Kenneth Skovhede, GEOGRAF A/S wrote:
 
 Just to be sure...
 
 The xml you posted is the ResourceHeader, and not the ResourceContent, 
 so it does not really show what the problem may be.
 The error from the log states that the runtime map is not created, which 
 is strange because a WebLayout cannot reference a runtime map.
 The other error you posted seemed to indicate that the Print command was 
 invalid inside the WebLayout.
 
 Can you try so save the xml, just before you write it to the MgByteStream?
 Then try to post the file, using the SetResource in the webform 
 mentioned earlier.
 If you get the same error, try to post the file somewhere, and provide a 
 link.
 Be carefull not to copy/paste, but post the actual file.
 
 Btw. how large is the file? larger than 8K?
 
 Regards, Kenneth Skovhede, GEOGRAF A/S
 
 
 
 ___
 mapguide-users mailing list
 mapguide-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapguide-users
 
 

-- 
View this message in context: 
http://n2.nabble.com/Create-programmatically-a-map-tp2314238p2347931.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] Create programmatically a map

2009-02-18 Thread Kenneth Skovhede, GEOGRAF A/S
There are/were problems reading data using the MgByteReader, as it would 
not return more than 8K.

You are using the native API, which, IMO, has some quirks.
Maestro uses the http interface to store the file, so that is equivalent 
to posting using the webform.


Regards, Kenneth Skovhede, GEOGRAF A/S



sekko970 skrev:

The file is 21K.
I tryed also to load it directly from Maestro, and I have had no problem.

--


Kenneth Skovhede, GEOGRAF A/S wrote:
  

Just to be sure...

The xml you posted is the ResourceHeader, and not the ResourceContent, 
so it does not really show what the problem may be.
The error from the log states that the runtime map is not created, which 
is strange because a WebLayout cannot reference a runtime map.
The other error you posted seemed to indicate that the Print command was 
invalid inside the WebLayout.


Can you try so save the xml, just before you write it to the MgByteStream?
Then try to post the file, using the SetResource in the webform 
mentioned earlier.
If you get the same error, try to post the file somewhere, and provide a 
link.

Be carefull not to copy/paste, but post the actual file.

Btw. how large is the file? larger than 8K?

Regards, Kenneth Skovhede, GEOGRAF A/S



___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users





  
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users


Re: [mapguide-users] Create programmatically a map

2009-02-13 Thread Kenneth Skovhede, GEOGRAF A/S
Does the OuterXml property contain the ? version=1.0 
encoding=utf-8 standalone=true ? line?


Regards, Kenneth Skovhede, GEOGRAF A/S



sekko970 skrev:

Hi Kenneth, and thanks for your promptly reply.

I had used an ancoding instance.

Below, you can see my code to create the new map:

Dim resID As New
MgResourceIdentifier(Library://.../maps/MyMap.MapDefinition)

Dim enc As New System.Text.UTF8Encoding(False)

Dim newMapDef As New MgByteSource(enc.GetBytes(XMLMapTemplate.OuterXml),
enc.GetByteCount(XMLMapTemplate.OuterXml))

newMapDef.SetMimeType(MgMimeType.Xml)

Dim resourceSrvc As MgResourceService =
siteConn.CreateService(MgServiceType.ResourceService)

resourceSrvc.SetResource(resID, newMapDef.GetReader(), Nothing)

Dim map As New MgMap()

map.Create(resourceSrvc, resID, MapName)

...

Then, this is my code to create the map layout:

Dim resID As New MgResourceIdentifier(Library://.../Layouts/MyMap.WebLayout)

Dim enc As New System.Text.UTF8Encoding(False)

Dim newLayoutDef As New
MgByteSource(enc.GetBytes(XMLLayoutTemplate.OuterXml),
enc.GetByteCount(XMLLayoutTemplate.OuterXml))

newLayoutDef.SetMimeType(MgMimeType.Xml)

resourceSrvc As MgResourceService =
siteConn.CreateService(MgServiceType.ResourceService)

resourceSrvc.SetResource(resID, newLayoutDef.GetReader(), Nothing)

map.Save(resourceSrvc)


Thanks for your help.
Fabio

--


Kenneth Skovhede, GEOGRAF A/S wrote:
  
You could have the problem that .Net emits an utf-8 byte-order-marker 
(BOM), when

writing xml.
http://en.wikipedia.org/wiki/Byte-order_mark

To counter this, explicitly create an encoding instance:
System.Text.Encoding enc = new System.Text.UTF8Encoding(false);

Then implement a xml writer, or manually convert the xml to bytes, using 
the encoding.


FYI, the MaestroAPI is LGPL, and so you may use it as a library, even 
for commercial applications,

and it handles this quirk and others.

Regards, Kenneth Skovhede, GEOGRAF A/S



sekko970 skrev:


Dear all,

I have created programmatically a map (and its layout) using MG .Net web
API.
After creation, the new map and layout are visible in MG Maestro, and
using
the 'Show in browser button are correctly shown in browser.

The problem happens when I load the map directly from browser, and the
following error appears:
 The type 'OSGeo.MapGuide.MgNullArgumentException' in assembly
'MapGuideDotNetApi, Version= 2.0.2.30 11, Culture=neutral,
PublicKeyToken=null' is not marked as serializable .

Then, simply saving the new layout from MG Maestro (without any
modification), and reloading the map directly from browser, the error
disappears and the map is correctly shown.

After saving the layout, there aren't differences in map and layout XML
definitions.

Have you any idea about?
Thank you in advance.
Fabio

  
  

___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users





  
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users


Re: [mapguide-users] Create programmatically a map

2009-02-13 Thread sekko970

Yes, the OuterXml property contains the XML header line.
Fabio

--


Kenneth Skovhede, GEOGRAF A/S wrote:
 
 Does the OuterXml property contain the ? version=1.0 
 encoding=utf-8 standalone=true ? line?
 
 Regards, Kenneth Skovhede, GEOGRAF A/S
 
 
 
 sekko970 skrev:
 Hi Kenneth, and thanks for your promptly reply.

 I had used an ancoding instance.

 Below, you can see my code to create the new map:

 Dim resID As New
 MgResourceIdentifier(Library://.../maps/MyMap.MapDefinition)

 Dim enc As New System.Text.UTF8Encoding(False)

 Dim newMapDef As New MgByteSource(enc.GetBytes(XMLMapTemplate.OuterXml),
 enc.GetByteCount(XMLMapTemplate.OuterXml))

 newMapDef.SetMimeType(MgMimeType.Xml)

 Dim resourceSrvc As MgResourceService =
 siteConn.CreateService(MgServiceType.ResourceService)

 resourceSrvc.SetResource(resID, newMapDef.GetReader(), Nothing)

 Dim map As New MgMap()

 map.Create(resourceSrvc, resID, MapName)

 ...

 Then, this is my code to create the map layout:

 Dim resID As New
 MgResourceIdentifier(Library://.../Layouts/MyMap.WebLayout)

 Dim enc As New System.Text.UTF8Encoding(False)

 Dim newLayoutDef As New
 MgByteSource(enc.GetBytes(XMLLayoutTemplate.OuterXml),
 enc.GetByteCount(XMLLayoutTemplate.OuterXml))

 newLayoutDef.SetMimeType(MgMimeType.Xml)

 resourceSrvc As MgResourceService =
 siteConn.CreateService(MgServiceType.ResourceService)

 resourceSrvc.SetResource(resID, newLayoutDef.GetReader(), Nothing)

 map.Save(resourceSrvc)


 Thanks for your help.
 Fabio

 --


 Kenneth Skovhede, GEOGRAF A/S wrote:
   
 You could have the problem that .Net emits an utf-8 byte-order-marker 
 (BOM), when
 writing xml.
 http://en.wikipedia.org/wiki/Byte-order_mark

 To counter this, explicitly create an encoding instance:
 System.Text.Encoding enc = new System.Text.UTF8Encoding(false);

 Then implement a xml writer, or manually convert the xml to bytes, using 
 the encoding.

 FYI, the MaestroAPI is LGPL, and so you may use it as a library, even 
 for commercial applications,
 and it handles this quirk and others.

 Regards, Kenneth Skovhede, GEOGRAF A/S



 sekko970 skrev:
 
 Dear all,

 I have created programmatically a map (and its layout) using MG .Net
 web
 API.
 After creation, the new map and layout are visible in MG Maestro, and
 using
 the 'Show in browser button are correctly shown in browser.

 The problem happens when I load the map directly from browser, and the
 following error appears:
  The type 'OSGeo.MapGuide.MgNullArgumentException' in assembly
 'MapGuideDotNetApi, Version= 2.0.2.30 11, Culture=neutral,
 PublicKeyToken=null' is not marked as serializable .

 Then, simply saving the new layout from MG Maestro (without any
 modification), and reloading the map directly from browser, the error
 disappears and the map is correctly shown.

 After saving the layout, there aren't differences in map and layout XML
 definitions.

 Have you any idea about?
 Thank you in advance.
 Fabio

   
   
 ___
 mapguide-users mailing list
 mapguide-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapguide-users


 

   
 
 ___
 mapguide-users mailing list
 mapguide-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapguide-users
 
 

-- 
View this message in context: 
http://n2.nabble.com/Create-programmatically-a-map-tp2314238p2320483.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] Create programmatically a map

2009-02-13 Thread Kenneth Skovhede, GEOGRAF A/S

Try to look at the Maestro code:
http://trac.osgeo.org/mapguide/browser/trunk/Tools/Maestro/MaestroAPI/LocalNativeConnection.cs#L182

Hopefully you will find a small difference there.

Regards, Kenneth Skovhede, GEOGRAF A/S



sekko970 skrev:

Yes, the OuterXml property contains the XML header line.
Fabio

--


Kenneth Skovhede, GEOGRAF A/S wrote:
  
Does the OuterXml property contain the ? version=1.0 
encoding=utf-8 standalone=true ? line?


Regards, Kenneth Skovhede, GEOGRAF A/S



sekko970 skrev:


Hi Kenneth, and thanks for your promptly reply.

I had used an ancoding instance.

Below, you can see my code to create the new map:

Dim resID As New
MgResourceIdentifier(Library://.../maps/MyMap.MapDefinition)

Dim enc As New System.Text.UTF8Encoding(False)

Dim newMapDef As New MgByteSource(enc.GetBytes(XMLMapTemplate.OuterXml),
enc.GetByteCount(XMLMapTemplate.OuterXml))

newMapDef.SetMimeType(MgMimeType.Xml)

Dim resourceSrvc As MgResourceService =
siteConn.CreateService(MgServiceType.ResourceService)

resourceSrvc.SetResource(resID, newMapDef.GetReader(), Nothing)

Dim map As New MgMap()

map.Create(resourceSrvc, resID, MapName)

...

Then, this is my code to create the map layout:

Dim resID As New
MgResourceIdentifier(Library://.../Layouts/MyMap.WebLayout)

Dim enc As New System.Text.UTF8Encoding(False)

Dim newLayoutDef As New
MgByteSource(enc.GetBytes(XMLLayoutTemplate.OuterXml),
enc.GetByteCount(XMLLayoutTemplate.OuterXml))

newLayoutDef.SetMimeType(MgMimeType.Xml)

resourceSrvc As MgResourceService =
siteConn.CreateService(MgServiceType.ResourceService)

resourceSrvc.SetResource(resID, newLayoutDef.GetReader(), Nothing)

map.Save(resourceSrvc)


Thanks for your help.
Fabio

--


Kenneth Skovhede, GEOGRAF A/S wrote:
  
  
You could have the problem that .Net emits an utf-8 byte-order-marker 
(BOM), when

writing xml.
http://en.wikipedia.org/wiki/Byte-order_mark

To counter this, explicitly create an encoding instance:
System.Text.Encoding enc = new System.Text.UTF8Encoding(false);

Then implement a xml writer, or manually convert the xml to bytes, using 
the encoding.


FYI, the MaestroAPI is LGPL, and so you may use it as a library, even 
for commercial applications,

and it handles this quirk and others.

Regards, Kenneth Skovhede, GEOGRAF A/S



sekko970 skrev:



Dear all,

I have created programmatically a map (and its layout) using MG .Net
web
API.
After creation, the new map and layout are visible in MG Maestro, and
using
the 'Show in browser button are correctly shown in browser.

The problem happens when I load the map directly from browser, and the
following error appears:
 The type 'OSGeo.MapGuide.MgNullArgumentException' in assembly
'MapGuideDotNetApi, Version= 2.0.2.30 11, Culture=neutral,
PublicKeyToken=null' is not marked as serializable .

Then, simply saving the new layout from MG Maestro (without any
modification), and reloading the map directly from browser, the error
disappears and the map is correctly shown.

After saving the layout, there aren't differences in map and layout XML
definitions.

Have you any idea about?
Thank you in advance.
Fabio

  
  
  

___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users




  
  

___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users





  
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users


[mapguide-users] Create programmatically a map

2009-02-12 Thread sekko970

Dear all,

I have created programmatically a map (and its layout) using MG .Net web
API.
After creation, the new map and layout are visible in MG Maestro, and using
the 'Show in browser button are correctly shown in browser.

The problem happens when I load the map directly from browser, and the
following error appears:
 The type 'OSGeo.MapGuide.MgNullArgumentException' in assembly
'MapGuideDotNetApi, Version= 2.0.2.30 11, Culture=neutral,
PublicKeyToken=null' is not marked as serializable .

Then, simply saving the new layout from MG Maestro (without any
modification), and reloading the map directly from browser, the error
disappears and the map is correctly shown.

After saving the layout, there aren't differences in map and layout XML
definitions.

Have you any idea about?
Thank you in advance.
Fabio

-- 
View this message in context: 
http://n2.nabble.com/Create-programmatically-a-map-tp2314238p2314238.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] Create programmatically a map

2009-02-12 Thread Kenneth Skovhede, GEOGRAF A/S
You could have the problem that .Net emits an utf-8 byte-order-marker 
(BOM), when

writing xml.
http://en.wikipedia.org/wiki/Byte-order_mark

To counter this, explicitly create an encoding instance:
System.Text.Encoding enc = new System.Text.UTF8Encoding(false);

Then implement a xml writer, or manually convert the xml to bytes, using 
the encoding.


FYI, the MaestroAPI is LGPL, and so you may use it as a library, even 
for commercial applications,

and it handles this quirk and others.

Regards, Kenneth Skovhede, GEOGRAF A/S



sekko970 skrev:

Dear all,

I have created programmatically a map (and its layout) using MG .Net web
API.
After creation, the new map and layout are visible in MG Maestro, and using
the 'Show in browser button are correctly shown in browser.

The problem happens when I load the map directly from browser, and the
following error appears:
 The type 'OSGeo.MapGuide.MgNullArgumentException' in assembly
'MapGuideDotNetApi, Version= 2.0.2.30 11, Culture=neutral,
PublicKeyToken=null' is not marked as serializable .

Then, simply saving the new layout from MG Maestro (without any
modification), and reloading the map directly from browser, the error
disappears and the map is correctly shown.

After saving the layout, there aren't differences in map and layout XML
definitions.

Have you any idea about?
Thank you in advance.
Fabio

  

___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users