<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I assume that you are aware of the FDO toolbox:<br>
<a class="moz-txt-link-freetext" href="http://code.google.com/p/fdotoolbox/">http://code.google.com/p/fdotoolbox/</a><br>
<br>
It can convert the SHP data to MSSQL quite easily.<br>
<br>
You can think of the runtime map as a binary version of the
MapDefinition xml.<br>
An instance of a runtime map is created for each session, and data from
the MapDefinition, LayerDefinition(s) and FeatureSource(s),<br>
are replicated into a binary representation. The replication allows for
speedups, and also for toggling layer visibilty without modifying the<br>
MapDefinition.<br>
<br>
The developers guide is more aimed at using MapGuide features. What you
are trying to do<br>
is more like authoring a map.<br>
<br>
I think the following steps are required<br>
<pre wrap="">1. Check if datasource exist.
1.1. If not - create it
1.1.1. Create XML and store it
2. Check if layer exist.
2.1. If not - create it.
2.1.1. Create Layer Definition XML and store it
2.1.2. Update either runtime map or MapDefinition XML

You can usually decide if you want to update the runtime map or the MapDefinition
by asking yourself: Are the changes meant for only the current user?
Yes, means runtime map, no means MapDefinition.

MapDefinition is just plain xml, and you can add the layer to
groups by using xml tags.

Runtime layers can be created using the MgLayer constructor,
with the LayerDefinition as a parameter. 
Then call map.Layers.Add(mglayer instance), and save the map.
</pre>
<pre class="moz-signature" cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
<br>
miansi skrev:
<blockquote cite="mid:1233855643141-2276183.post@n2.nabble.com"
 type="cite">
  <pre wrap="">I want to create both.

I have SHP file and need to develop procedure which will load it into SQL
2008 table, create Datasource and Layer and update Map.

I am aware of generating XML files and actualy already doing that. The one
thing which is unclear for me just yet is "runtime map". As far as I
understand you not only have to generate XML and store it, but you also have
to update "runtime map", so your changes will be populated on the map
immediately.

What is the sequence of following steps? What you suppose to do in every
step (update xml, work with MGOS API)?
- Add Layer Definition to the Map
- Add Layer Resource t the Map

Can you please clarify for me sequence of procedures for the case when I
need to add layer from SQL 2008 View to the map.

1. Check if datasource exist.
1.1. If not - create it
1.1.1. Create XML and store it
2. Check if layer exist.
2.1. If not - create it.
2.1.1. Add Layer Definition?
2.1.2. Add Layer Resource?
2.1.3. Add Layer to the Group
2.1.4. Update runtime map?


Did I miss it in MGOS Developer's Guide?

Looks like I understand some bits and pieces here and there and all I need
to know is sequence of events for adding Datasource and layer from SQL 2008
to map.


Thank you for the links!




Kenneth Skovhede, GEOGRAF A/S wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">It's a bit unclear to me what you are asking for.

Do you want to create a FeatureSource by code, a LayerDefiniton, or both?

Both are constructed from xml files, and the xml file definitions can be 
found in the "schemas" subfolder of your MapGuide installation.

The easy way to do this is usually to setup the 
FeatureSource/LayerDefinition in Studio/Maestro
Then save the Xml, and use that as a template for creating new items.
Eg, in the LayerDefinition, change the color, or FeatureSource/Table.

You create a new item by calling the SetResource method on an 
MgResourceService object.

For sample code, feel free to browse the Maestro repository (in C#):
<a class="moz-txt-link-freetext" href="http://trac.osgeo.org/mapguide/wiki/maestro/Sourcecode">http://trac.osgeo.org/mapguide/wiki/maestro/Sourcecode</a>

For instance, the MSSQL provider editor is here:
<a class="moz-txt-link-freetext" href="http://svn.osgeo.org/mapguide/trunk/Tools/Maestro/Maestro/ResourceEditors/FeatureSourceEditors/MSQLSpatial/FeatureSourceEditorMSSQLSpatial.cs">http://svn.osgeo.org/mapguide/trunk/Tools/Maestro/Maestro/ResourceEditors/FeatureSourceEditors/MSQLSpatial/FeatureSourceEditorMSSQLSpatial.cs</a>

Regards, Kenneth Skovhede, GEOGRAF A/S



miansi skrev:
    </pre>
    <blockquote type="cite">
      <pre wrap="">Hello,

I've got my Datasource pointing to the SQL 2008 database. In the database
I
have few views which I would like to expose as layers on the map. I am
using
FDO 3.3.2

<a class="moz-txt-link-freetext" href="http://n2.nabble.com/file/n2267589/image001.jpg">http://n2.nabble.com/file/n2267589/image001.jpg</a> 

I saw following examples:
<a class="moz-txt-link-freetext" href="http://n2.nabble.com/Draw-Line-ASP-.NET...-td1818630.html">http://n2.nabble.com/Draw-Line-ASP-.NET...-td1818630.html</a>
<a class="moz-txt-link-freetext" href="http://svnmirror.osgeo.org/mapguide/tags/MAPGUIDE2.0.1/Web/src/mapviewerjava/measure.jsp">http://svnmirror.osgeo.org/mapguide/tags/MAPGUIDE2.0.1/Web/src/mapviewerjava/measure.jsp</a>

and I read "Another Way To Create Layers" from MGOS 2.0 Developer's
Guide.

I think that I understand the core idea, but need help with details as I
have troubles modifying code from the examples above to fit my
requirements.

Can I find somewhere guide as how to programmatically add/remove SQL 2008
datasource and layer attached to this datasource? Or maybe someone will
be
generous enough to share sample of code?
I do not care if it would be PHP, Java, VB or C#. Will be able to
understand
C++ too :-)


Thank you!
  
      </pre>
    </blockquote>
    <pre wrap="">_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>


    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
</blockquote>
</body>
</html>