[mapguide-users] help

saloua wakrim wakrimsaloua.wakrim at gmail.com
Mon May 11 03:37:20 EDT 2009


and i have the same prob with inserting polygone in layerand this time even
with mapguide Studio i don't see the polygone in layer , this is my code i
give it you may be it will help you see my error :
As cordinates i pass

 Dim x() As Double = {0, 2, 2, 0, 0}
  Dim y() As Double = {0, 0, 2, 2, 0}
just for testing and for constituting polygone i do that: (as i've show you
in my code)



        Dim poly As MgPolygon
        Dim geomfactory As MgGeometryFactory = New MgGeometryFactory()
        Dim coordcol As MgCoordinateCollection = New
MgCoordinateCollection()
        Dim j As Integer
        For j = 0 To 4
        Dim coord As MgCoordinate = geomfactory.CreateCoordinateXY(a(j),
b(j))
        coordcol.Add(coord)
        j = j + 1

        Next
        Dim outring As MgLinearRing = geomfactory.CreateLinearRing(coordcol)
         poly = geomfactory.CreatePolygon(outring, Nothing)

        Dim agf As MgAgfReaderWriter = New MgAgfReaderWriter()

        properties.Add(New MgGeometryProperty("GEOM", agf.Write(poly)))


another prob that i have that i can't see the layer i add after refreshing
map (conntained in <iframe>)for saying layer i use mapguide studio where i
see the layer wich doesn't contain the polygon, may be pro in type of
geometry i give or another, i'll give all complete code it will help you see
my error and help me if you can, i've spent a lot of time at that but i
don't see my error and why even i add layer in map i don't see it and when i
see it using mapguide studio it doesn't contain polygone i insert.i have
even tested to insert polygone with text shape (("POLYGON XY ((0 0, 2 0, 2
2, 0 2, 0 0))" in function makeLine2() as you see)but it doesn't run too.i
don't know what do, please help me if you can do it. Thanks a lot in
advance.


<%@ Page Language="VB" AutoEventWireup="true" CodeFile="essai.aspx.vb"
Inherits="essai" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Collections.Specialized" %>
<%@ Import Namespace="OSGeo.MapGuide" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Globalization" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>selection</title>

</head>
<body>
<br />
 <%


        Dim sessionid1 As String
     Dim siteConnection As MgSiteConnection
     Dim resourceSrvc As MgResourceService
     Dim myLayerName As String = "line9"
     Dim mapname As String = "Sheboygan"
     Dim map As MgMap
     Dim featureSrvc As MgFeatureService
     Dim myLayer As MgLayer

     Dim configPath As String = "C:\Program
Files\Autodesk\MapGuideEnterprise2008\WebServerExtensions\www\webconfig.ini"
     MapGuideApi.MgInitializeWebTier(configPath)
     Dim site1 As MgSite = New MgSite()
     Dim userInfo As MgUserInformation = New
MgUserInformation("Administrator", "admin")
     siteConnection = New MgSiteConnection()
     siteConnection.Open(userInfo)
     site1 = siteConnection.GetSite()
     sessionid1 = site1.CreateSession()
     userInfo.SetMgSessionId(sessionid1)
     resourceSrvc =
siteConnection.CreateService(MgServiceType.ResourceService)
     featureSrvc =
siteConnection.CreateService(MgServiceType.FeatureService)

     Response.Charset = "utf-8"
     Dim layerDef As String = "Library://Samples/Sheboygan/Layers/" +
myLayerName + ".LayerDefinition"
     Dim layerDefId As MgResourceIdentifier = New
MgResourceIdentifier(layerDef)
     Dim dataSource As String = "Library://Samples/Sheboygan/Data/" +
myLayerName + ".FeatureSource"
     Dim dataSourceId As MgResourceIdentifier = New
MgResourceIdentifier(dataSource)
     Dim resourceID2 As MgResourceIdentifier = New
MgResourceIdentifier("Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition")

     map = New MgMap(siteConnection)
     map.Create(resourceSrvc, resourceID2, mapname)

     map.Save()
     map.Open(resourceSrvc, mapname)
     Dim myClassDef As MgClassDefinition
     If (DoesLayerExist(myLayerName, map) = False) Then

         '//create Feature Source
         myClassDef = New MgClassDefinition()
         myClassDef.SetName("line9")
         'myClassDef.SetDescription(myLayerName + " Feature Source")
         'myClassDef.SetDefaultGeometryPropertyName("SHPGEOM")
         'Set KEY Property
         Dim prop As MgDataPropertyDefinition = New
MgDataPropertyDefinition("KEY")
         prop.SetDataType(MgPropertyType.Int32)
         prop.SetAutoGeneration(True)
         prop.SetReadOnly(True)
         prop.SetNullable(False)
         myClassDef.GetProperties().Add(prop)
         myClassDef.GetIdentityProperties().Add(prop)
         'Set ID Property
         prop = New MgDataPropertyDefinition("ID")
         prop.SetDataType(MgPropertyType.Int32)
         myClassDef.GetProperties().Add(prop)


         'et geometry property
         Dim geomProp As MgGeometricPropertyDefinition = New
MgGeometricPropertyDefinition("GEOM")
         geomProp.SetGeometryTypes(MgFeatureGeometricType.Surface)
         geomProp.SetHasElevation(False)
         geomProp.SetHasMeasure(False)
         geomProp.SetSpatialContextAssociation("LL84")
         myClassDef.GetProperties().Add(geomProp)
         'myClassDef.SetDefaultGeometryPropertyName("SHPGEOM")
         'Create the schema
         Dim schema As MgFeatureSchema = New MgFeatureSchema()
         schema.SetName("SHP_Shema")
         schema.GetClasses().Add(myClassDef)

         Dim sdfParams As MgCreateSdfParams = New MgCreateSdfParams("MGA-56
(GDA94 /MGA zone 56)", map.GetMapSRS(), schema)
         featureSrvc.CreateFeatureSource(dataSourceId, sdfParams)



         Dim content As MgByteSource = New MgByteSource("C:\Program
Files\Autodesk\MapGuideEnterprise2008\WebServerExtensions\www\createpoint\LayerDefinition.xml")
         resourceSrvc.SetResource(layerDefId, content.GetReader(), Nothing)
         myLayer = New MgLayer(layerDefId, resourceSrvc)
         myLayer.SetName(myLayerName)
         myLayer.SetLegendLabel(myLayerName)
         myLayer.SetDisplayInLegend(True)
         myLayer.SetSelectable(False)
         map.GetLayers().Insert(0, myLayer)
         'map.GetLayers().Add(myLayer)
         myLayer.ForceRefresh()
       map.Save(resourceSrvc)



     End If


       Dim insertFeatures2 As MgInsertFeatures = New
MgInsertFeatures(myLayerName, makeLine())

     Dim commands As MgFeatureCommandCollection = New
MgFeatureCommandCollection()

     commands.Add(insertFeatures2)

    myLayer.UpdateFeatures(commands)












 %>
<div id="viewer">
 <iframe id="carte" width="800" height="300" frameborder="0" scrolling="no"
src="http://localhost/mapguide2008/mapviewerajax/?SESSION=<%=sessionid1%>&WEBLAYOUT=Library%3a%2f%2fSamples%2fSheboygan%2fLayouts%2fSheboyganAsp.WebLayout"
name="fenetre"></iframe>
 </div>
 <br />
 <div>
<input type="button" value="zoom" name="zoom" onclick="zoom()"/>
</div>
<br />
<div>
<input type="button" value="rafraichir" name="calque"
onclick="testcalque();"/>
</div>

</body>
<script type="text/javascript">
    var str2;
    var str;


    function zoom()
    {
    carte.GetMapFrame().ZoomToView(-87.7116768,43.7766789973,5000,true);

     }
     function testcalque()
    {
    //carte.GetMapFrame().GetLayers(true,true);
   //carte.GetScriptFrame().location.href = "essai.aspx";
   frames['fenetre'].location.reload();
    carte.GetMapFrame().Refresh();
    //carte.ExecuteMapAction(20);
    //carte.GetMapFrame().ExecuteMapAction(1);
    //carte.GetTaskFrame().location.href = "essai.aspx"
    //carte.GetScriptFrame().location.href = "essai.aspx"
    //carte.GetMapFrame().ExecuteMapAction(20);

    //carte.GetMapFrame().ExecuteMapAction(20);
    }


</script>

<script runat="server">

    Public Function makeLine() As MgPropertyCollection

        Dim x() As Double = {0, 2, 2, 0, 0}
     Dim y() As Double = {0, 0, 2, 2, 0}

        Dim poly As MgPolygon
        Dim geomfactory As MgGeometryFactory = New MgGeometryFactory()
        Dim coordcol As MgCoordinateCollection = New
MgCoordinateCollection()
        Dim j As Integer
        For j = 0 To 4
        Dim coord As MgCoordinate = geomfactory.CreateCoordinateXY(x(j),
y(j))
        coordcol.Add(coord)
        j = j + 1

        Next
        Dim outring As MgLinearRing = geomfactory.CreateLinearRing(coordcol)
        poly = geomfactory.CreatePolygon(outring, Nothing)

        Dim agf As MgAgfReaderWriter = New MgAgfReaderWriter()

        properties.Add(New MgGeometryProperty("GEOM", agf.Write(poly)))


    return properties

    End Function
    Public Function makeLine2() As MgPropertyCollection
        Dim PropertyCollection2 As MgPropertyCollection = New
MgPropertyCollection()
        Dim nameProperty2 As MgInt32Property = New MgInt32Property("ID", 1)
        PropertyCollection2.Add(nameProperty2)
        Dim wktReaderWriter2 As MgWktReaderWriter = New MgWktReaderWriter()
        Dim agfReaderWriter2 As MgAgfReaderWriter = New MgAgfReaderWriter()
        Dim geometry2 As MgPolygon = wktReaderWriter2.Read("POLYGON XY ((0
0, 2 0, 2 2, 0 2, 0 0))")


        Dim geometryByteReader2 As MgByteReader =
agfReaderWriter2.Write(geometry2)
        Dim geometryProperty2 As MgGeometryProperty = New
MgGeometryProperty("GEOM", geometryByteReader2)
        PropertyCollection2.Add(geometryProperty2)
        Return PropertyCollection2
    End Function


    Function DoesLayerExist(ByVal LayerName As String, ByVal Map As MgMap)
As Boolean
        Dim layers As MgLayerCollection = Map.GetLayers()
        Return (layers.Contains(LayerName))
    End Function




</script>



</html>




2009/5/11 javed shaikh <jaspune at hotmail.com>

> Wakrim
>
> Could you tell me what is the error?
>
> You were code is technically correct, if you can tell me what is the error
> i can help you.
>
> Before that make sure you are passing corrrect cordinates (last co ordinate
> is same as first) you are passing correct layer scheme and inserting in
> correct session.
>
> J
>
> > From: wakrimsaloua.wakrim at gmail.com
> > To: jaspune at hotmail.com
> > Subject: please help me if you can
> > Date: Sat, 9 May 2009 04:13:56 -0700
> >
> > hi, i've the same prob that you have, but i can't resolve it, i use this
> code for drawning polygon ,but it doesn't draw it, please correct it me if
> you have time to do it, this is my mail: wakrimsaloua.wakrim at gmail.com,
> this is my code:
> >
> > If (DoesLayerExist(myLayerName, map) = False) Then
> >
> >
> > '//create Feature Source
> > Dim myClassDef As MgClassDefinition = New MgClassDefinition()
> > myClassDef.SetName("saloua3")
> > 'myClassDef.SetDescription(myLayerName + " Feature Source")
> > myClassDef.SetDefaultGeometryPropertyName("SHPGEOM")
> >
> > 'Set KEY Property
> > Dim prop As MgDataPropertyDefinition = New
> MgDataPropertyDefinition("KEY")
> > prop.SetDataType(MgPropertyType.Int32)
> > prop.SetAutoGeneration(True)
> > prop.SetReadOnly(True)
> > prop.SetNullable(False)
> > myClassDef.GetProperties().Add(prop)
> > myClassDef.GetIdentityProperties().Add(prop)
> >
> > 'Set ID Property
> > prop = New MgDataPropertyDefinition("ID")
> > prop.SetDataType(MgPropertyType.Int32)
> > myClassDef.GetProperties().Add(prop)
> >
> > 'add poly
> >
> > Dim poly As MgPolygon
> > Dim geomfactory As MgGeometryFactory = New MgGeometryFactory()
> > Dim coordcol As MgCoordinateCollection = New MgCoordinateCollection()
> > Dim j As Integer
> > For j = 0 To 3
> > Dim coord As MgCoordinate = geomfactory.CreateCoordinateXY(x(j), y(j))
> > coordcol.Add(coord)
> >
> > Next
> > Dim outring As MgLinearRing = geomfactory.CreateLinearRing(coordcol)
> > poly = geomfactory.CreatePolygon(outring, Nothing)
> > Dim agf As MgAgfReaderWriter = New MgAgfReaderWriter()
> >
> > 'Dim geom As MgByteReader = geometryReaderWriter.Write(poly)
> > properties = New MgPropertyCollection()
> > properties.Add(New MgGeometryProperty("GEOM", agf.Write(poly)))
> >
> > 'et geometry property
> > Dim geomProp As MgGeometricPropertyDefinition = New
> MgGeometricPropertyDefinition("SHPGEOM")
> > geomProp.SetGeometryTypes(MgFeatureGeometricType.Curve)
> > geomProp.SetHasElevation(False)
> > geomProp.SetHasMeasure(False)
> > geomProp.SetSpatialContextAssociation("LL84")
> > myClassDef.GetProperties().Add(geomProp)
> > myClassDef.SetDefaultGeometryPropertyName("SHPGEOM")
> >
> > 'Create the schema
> > Dim schema As MgFeatureSchema = New MgFeatureSchema()
> > schema.SetName("SHP_Shema")
> > schema.GetClasses().Add(myClassDef)
> >
> >
> > Dim sdfParams As MgCreateSdfParams = New MgCreateSdfParams("MGA-56 (GDA94
> /MGA zone 56)", map.GetMapSRS(), schema)
> >
> > featureSrvc.CreateFeatureSource(dataSourceId, sdfParams)
> >
> >
> > 'Dim layerDefContent As MgByteReader =
> BuildLayerDefinitionContent(dataSource, "SHP_Shema:linetestvb4", "", "5",
> "F000F")
> > 'resourceSrvc.SetResource(layerDefId, layerDefContent, nothing)
> >
> > Dim content As MgByteSource = New MgByteSource("C:\Program
> Files\Autodesk\MapGuideEnterprise2008\WebServerExtensions\www\testvb\LayerDefinition.xml")
> > resourceSrvc.SetResource(layerDefId, content.GetReader(), Nothing)
> >
> > Dim myLayer As MgLayer = New MgLayer(layerDefId, resourceSrvc)
> > myLayer.SetName(myLayerName)
> > myLayer.SetLegendLabel("legend" + myLayerName)
> > myLayer.SetDisplayInLegend(True)
> > myLayer.SetSelectable(True)
> > map.GetLayers().Insert(0, myLayer)
> > 'map.GetLayers().Add(myLayer)
> > myLayer.ForceRefresh()
> > map.Save(resourceSrvc)
> > Dim insertFeatures As MgInsertFeatures = New
> MgInsertFeatures(myLayerName, properties)
> > Dim commands As MgFeatureCommandCollection = New
> MgFeatureCommandCollection()
> > commands.Add(insertFeatures)
> > Dim commandIndex As Integer = commands.IndexOf(insertFeatures)
> >
> > Dim insertResults As MgPropertyCollection
> >
> > insertResults = featureSrvc.UpdateFeatures(dataSourceId, commands, False)
> > End If
>
>
>
> 2009/5/11 saloua wakrim <wakrimsaloua.wakrim at gmail.com>

> thanks a lot for your replay,yes, i'm sure, i've tried another code and
> with mapguide studio i see the layer that i add, it contains the line wich i
> insert, but on iframe (where the map is displayed) i don't see the layer and
> even in mapguide studio with the layers belonging to the map, i don't see
> the layer (it's not added), this is my complete code:
>
>
> <%
> @ Page Language="VB" AutoEventWireup="true" CodeFile="essai.aspx.vb"
>
>
>
> Inherits
> ="essai" %>
>
> <%
> @ Import Namespace="System" %>
>
> <%
> @ Import Namespace="System.IO" %>
>
> <%
> @ Import Namespace="System.Collections.Specialized" %>
>
> <%
> @ Import Namespace="OSGeo.MapGuide" %>
>
> <%
> @ Import Namespace="System.Text" %>
>
> <%
> @ Import Namespace="System.Globalization" %>
>
>
>
>
>
>
>
> <!
> DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>
>
>
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
>
>
>
>
> <
> html xmlns="http://www.w3.org/1999/xhtml" >
>
> <
> head id="Head1" runat="server">
>
>
>
> <title>selection</title>
>
>
>
>
>
> </
> head>
>
> <
> body>
>
> <
> br />
>
>
>
> <%
>
>  Dim x0 As String = "100"
>
> Dim y0 As String = "100"
>
>
>
> Dim x1 As String = "120"
>
>
>
> Dim y1 As String = "120"
>
>
>
> Dim sessionid1 As String
>
>
>
> Dim siteConnection As MgSiteConnection
>
> Dim resourceSrvc As MgResourceService
>
> Dim myLayerName As String = "line6"
>
>
>
> Dim mapname As String = "Sheboygan"
>
>
>
> Dim map As MgMap
>
> Dim featureSrvc As MgFeatureService
>
> Dim myLayer As MgLayer
>
> Dim configPath As String = "C:\Program
> Files\Autodesk\MapGuideEnterprise2008\WebServerExtensions\www\webconfig.ini"
>
>
>
>
> MapGuideApi.MgInitializeWebTier(configPath)
>
> Dim site1 As MgSite = New MgSite()
>
> Dim userInfo As MgUserInformation = New MgUserInformation("Administrator",
> "admin")
>
> siteConnection =
> New MgSiteConnection()
>
> siteConnection.Open(userInfo)
>
> site1 = siteConnection.GetSite()
>
> sessionid1 = site1.CreateSession()
>
> userInfo.SetMgSessionId(sessionid1)
>
> resourceSrvc = siteConnection.CreateService(MgServiceType.ResourceService)
>
> featureSrvc = siteConnection.CreateService(MgServiceType.FeatureService)
>
> Response.Charset =
> "utf-8"
>
>
>
> Dim layerDef As String = "Library://Samples/Sheboygan/Layers/" +
> myLayerName + ".LayerDefinition"
>
>
>
> Dim layerDefId As MgResourceIdentifier = NewMgResourceIdentifier(layerDef)
>
> Dim dataSource As String = "Library://Samples/Sheboygan/Data/" +
> myLayerName + ".FeatureSource"
>
>
>
> Dim dataSourceId As MgResourceIdentifier = NewMgResourceIdentifier(dataSource)
>
> Dim resourceID2 As MgResourceIdentifier = New MgResourceIdentifier(
> "Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition")
>
> map =
> New MgMap(siteConnection)
>
> map.Create(resourceSrvc, resourceID2, mapname)
>
> map.Save()
>
> map.Open(resourceSrvc, mapname)
>
> Dim myClassDef As MgClassDefinition
>
> If (DoesLayerExist(myLayerName, map) = False) Then
>
>
>
> '//create Feature Source
>
>
>
> myClassDef =
> New MgClassDefinition()
>
> myClassDef.SetName(
> "line6")
>
> 'myClassDef.SetDescription(myLayerName + " Feature Source")
>
>
>
> 'myClassDef.SetDefaultGeometryPropertyName("SHPGEOM")
>
>
>
> 'Set KEY Property
>
>
>
> Dim prop As MgDataPropertyDefinition = New MgDataPropertyDefinition("KEY")
>
>
> prop.SetDataType(MgPropertyType.Int32)
>
> prop.SetAutoGeneration(
> True)
>
> prop.SetReadOnly(
> True)
>
> prop.SetNullable(
> False)
>
> myClassDef.GetProperties().Add(prop)
>
> myClassDef.GetIdentityProperties().Add(prop)
>
> 'Set ID Property
>
>
>
> prop =
> New MgDataPropertyDefinition("ID")
>
> prop.SetDataType(MgPropertyType.Int32)
>
> myClassDef.GetProperties().Add(prop)
>
>  'et geometry property
>
>
>
> Dim geomProp As MgGeometricPropertyDefinition = NewMgGeometricPropertyDefinition(
> "SHPGEOM")
>
> geomProp.SetGeometryTypes(MgFeatureGeometricType.Point)
>
> geomProp.SetHasElevation(
> False)
>
> geomProp.SetHasMeasure(
> False)
>
> geomProp.SetSpatialContextAssociation(
> "LL84")
>
> myClassDef.GetProperties().Add(geomProp)
>
> 'Create the schema
>
>
>
> Dim schema As MgFeatureSchema = New MgFeatureSchema()
>
> schema.SetName(
> "SHP_Shema")
>
> schema.GetClasses().Add(myClassDef)
>
> Dim sdfParams As MgCreateSdfParams = New MgCreateSdfParams("MGA-56 (GDA94
> /MGA zone 56)", map.GetMapSRS(), schema)
>
> featureSrvc.CreateFeatureSource(dataSourceId, sdfParams)
>
>
>
>  Dim content As MgByteSource = New MgByteSource("C:\Program
> Files\Autodesk\MapGuideEnterprise2008\WebServerExtensions\www\createpoint\LayerDefinition.xml")
>
>
> resourceSrvc.SetResource(layerDefId, content.GetReader(),
> Nothing)
>
> myLayer =
> New MgLayer(layerDefId, resourceSrvc)
>
> myLayer.SetName(myLayerName)
>
> myLayer.SetLegendLabel(myLayerName)
>
> myLayer.SetDisplayInLegend(
> True)
>
> myLayer.SetSelectable(
> False)
>
> map.GetLayers().Insert(0, myLayer)
>
> 'map.GetLayers().Add(myLayer)
>
>
>
> myLayer.ForceRefresh()
>
> map.Save(resourceSrvc)
>
>  End If
>
>
>
>  Dim insertFeatures2 As MgInsertFeatures = New
> MgInsertFeatures(myLayerName, makeLine2("1", x0, y0, x1, y1))
>
>
>
> Dim commands As MgFeatureCommandCollection = NewMgFeatureCommandCollection()
>
> commands.Add(insertFeatures2)
>
>
>
> myLayer.UpdateFeatures(commands)
>
>
>
>
>
>   %>
>
>
>
> <
> div id="viewer">
>
>
>
> <iframe id="carte" width="800" height="300" frameborder="0" scrolling="no"
> src="http://localhost/mapguide2008/mapviewerajax/?SESSION=<%=sessionid1 %>
> &WEBLAYOUT=Library%3a%2f%2fSamples%2fSheboygan%2fLayouts%2fSheboyganAsp.WebLayout"
> name="fenetre"></iframe>
>
>
>
> </div>
>
>
>
> <br />
>
>
>
> </
> body>
>
> <
> script type="text/javascript">
>
>
>
> function refresh()
>
> {
>
> //carte.GetMapFrame().GetLayers(true,true);
>
>
>
> //carte.GetScriptFrame().location.href = "essai.aspx";
>
>
>
> frames[
> 'fenetre'].location.reload();
>
> carte.GetMapFrame().Refresh();
>
> //carte.ExecuteMapAction(20);
>
>
>
> //carte.GetMapFrame().ExecuteMapAction(1);
>
>
>
> //carte.GetTaskFrame().location.href = "essai.aspx"
>
>
>
> //carte.GetScriptFrame().location.href = "essai.aspx"
>
>
>
> //carte.GetMapFrame().ExecuteMapAction(20);
>
>
>
>
>
> //carte.GetMapFrame().ExecuteMapAction(20);
>
>
>
> }
>
> </
> script>
>
>
>
> <
> script runat="server">
>
>
>
>
>
> Public
> Function makeLine2(ByVal Name As String, ByVal x0 As String, ByVal y0 As
> String, ByVal x1 As String, ByVal y1 As String) As MgPropertyCollection
>
> Dim PropertyCollection2 As MgPropertyCollection = NewMgPropertyCollection()
>
> Dim nameProperty2 As MgInt32Property = New MgInt32Property("ID", 1)
>
> PropertyCollection2.Add(nameProperty2)
>
> Dim wktReaderWriter2 As MgWktReaderWriter = New MgWktReaderWriter()
>
> Dim agfReaderWriter2 As MgAgfReaderWriter = New MgAgfReaderWriter()
>
> Dim geometry2 As MgGeometry = wktReaderWriter2.Read("LINESTRING XY (" + x0
> + " " + y0 + "," + x1 + " " + y1 + ")")
>
>  Dim geometryByteReader2 As MgByteReader =
> agfReaderWriter2.Write(geometry2)
>
> Dim geometryProperty2 As MgGeometryProperty = New MgGeometryProperty(
> "SHPGEOM", geometryByteReader2)
>
> PropertyCollection2.Add(geometryProperty2)
>
> Return PropertyCollection2
>
> End Function
>
>  Function DoesLayerExist(ByVal LayerName As String, ByVal Map As MgMap) As Boolean
>
>
>
>
> Dim layers As MgLayerCollection = Map.GetLayers()
>
> Return (layers.Contains(LayerName))
>
> End Function
>
>
>
> Function LoadTemplate2(ByVal filePath As String) As String
>
>
>
> Dim sr As StreamReader = File.OpenText(filePath)
>
> Dim template As String = sr.ReadToEnd()
>
> Return template
>
> End Function
>
>
>
>
>
>
>
> </
> script>
>
>
>
>
>
>
>
>
>
>
>
>
>
> </
> html>
>
>
>
>
> ------------------------------
>
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>
>
>>
>> _______________________________________________
>> mapguide-users mailing list
>> mapguide-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20090511/db40e063/attachment.html


More information about the mapguide-users mailing list