[mapguide-users] How to create Layer and Datasource and link it
to SQL 2008 Datasource in code
AndreiSinelnikov at SierraSystems.com
Thu Feb 5 12:40:43 EST 2009
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
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
Thank you for the links!
Kenneth Skovhede, GEOGRAF A/S wrote:
> 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#):
> For instance, the MSSQL provider editor is here:
> Regards, Kenneth Skovhede, GEOGRAF A/S
> miansi skrev:
>> I've got my Datasource pointing to the SQL 2008 database. In the database
>> have few views which I would like to expose as layers on the map. I am
>> FDO 3.3.2
>> I saw following examples:
>> and I read "Another Way To Create Layers" from MGOS 2.0 Developer's
>> 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
>> Can I find somewhere guide as how to programmatically add/remove SQL 2008
>> datasource and layer attached to this datasource? Or maybe someone will
>> generous enough to share sample of code?
>> I do not care if it would be PHP, Java, VB or C#. Will be able to
>> C++ too :-)
>> Thank you!
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
View this message in context: http://n2.nabble.com/How-to-create-Layer-and-Datasource-and-link-it-to-SQL-2008-Datasource-in-code-tp2267589p2276183.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users