hi i want get coordinates of the point inserted in map how can i proceed? thanks on advance<br><br>
<div class="gmail_quote">2009/5/25 saloua wakrim <span dir="ltr"><<a href="mailto:wakrimsaloua.wakrim@gmail.com">wakrimsaloua.wakrim@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">hello! i drw polygones in map and display it i want know how can i get them transparent for allowing me see another layers, thanks on advance, i thi,k that this will be modification in xml file where i define layer containing polygone but how, if you have some idea thanks on advance<br>
<br>
<div class="gmail_quote">2009/5/20 Kenneth Skovhede, GEOGRAF A/S <span dir="ltr"><<a href="mailto:ks@geograf.dk" target="_blank">ks@geograf.dk</a>></span>
<div>
<div></div>
<div class="h5"><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div bgcolor="#ffffff" text="#000000">UNIT is the coordinate system unit, eg. degrees, meters or inches.<br><br>If the layers and map have the correct coordinate systems assigned, <br>MapGuide will automatically convert the data to display correctly,<br>
so you get the correct map.<br><br>You do not have to work with the projection string manually.<br>Beware of trying to calculate coordinates manually based on the UNIT, because<br>projections are not always compatible just because the use the same UNIT.<br>
Instead, use the MgCoordinateSystem classes to convert points from one projection to another.
<div>
<div></div>
<div><br><pre cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre><br><br>saloua wakrim skrev:
<blockquote type="cite">
<div>but please if you know what that UNIT means in coordinates System say it me:</div>
<div> </div><font color="#0000ff" size="2">
<p><</p></font><font color="#800000" size="2">CoordinateSystem</font><font color="#0000ff" size="2">></font><font size="2">GEOGCS["WGS84 Lat/Long's, Degrees, -180 ==> +180",DATUM["D_WGS_1984",SPHEROID["World_Geodetic_System_of_1984",6378137,298.257222932867]],PRIMEM["Greenwich",0],<strong><u>UNIT</u></strong>["Degree",0.017453292519943295]]</font><font color="#0000ff" size="2"></</font><font color="#800000" size="2">CoordinateSystem</font><font color="#0000ff" size="2">> </font>cause i want draw polygone representing view of cam (dome) and it must be proportional to the real view of cam, and my layer must be added to map with another layer wich contains cams so i must know wich units is used on map(m, km, cm) or what? that what i do that i convert (m) to unit by this code:
<div> </div>
<div><font color="#008080" size="2">
<p>MgCoordinateSystemFactory</p></font><font size="2">csFactory = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#008080" size="2">MgCoordinateSystemFactory</font><font size="2">(); </font><font color="#008080" size="2">MgCoordinateSystem</font><font size="2"> srs = csFactory.Create(map.GetMapSRS()); </font><font color="#008080" size="2">MgCoordinateSystemMeasure</font><font size="2"> mesure = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#008080" size="2">MgCoordinateSystemMeasure</font><font size="2">(srs);
<p>distanceunits = pointa.Distance(pointb, mesure);</p>
<p>Response.Write(</p></font><font color="#800000" size="2">"distance entre les deux points du calque en unit‚: "</font><font size="2">+distanceunits.ToString());
<p>distancemeters = srs.ConvertCoordinateSystemUnitsToMeters(distanceunits);</p></font><font size="2">but i don't know if this layer (wich contains polygone) will be compatible with another layer or not? if you don't understand me say it me please. thanks or advance, i ask you cause i remark that you master more than onother mapguide developpers mapguide, thanks on advance.</font><font size="2"> </font><font size="2"> </font><br>
<br></div>
<div class="gmail_quote">2009/5/19 Kenneth Skovhede, GEOGRAF A/S <span dir="ltr"><<a href="mailto:ks@geograf.dk" target="_blank">ks@geograf.dk</a>></span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<div bgcolor="#ffffff" text="#000000">There is an example for MgCreateSdfParams() in the "buffer.(php|aspx|jsp)" file in the folder<br>C:\program files\MapGuideOpenSource2.0\WebServerExtensions\www\mapviewer(php|net|java)<br>
<br>It also shows how to set the coordinate system.<br>If your data has the correct projection, MapGuide will convert it to fit the map projection.<br>If that does not work, you have to manually convert the items, which is not a trivial procedure.
<div>
<div><br><pre cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre><br><br>saloua wakrim skrev:
<blockquote type="cite">hi! did you know lease how MgCreateSdfParams() works and what attributes i must give it cause ii think that the prob i have is coordinates i use for inserting polygone or line or point wich are not compatibl with map cordinates <br>
<br>
<div><span class="gmail_quote">2009/5/11, Kenneth Skovhede, GEOGRAF A/S <<a href="mailto:ks@geograf.dk" target="_blank">ks@geograf.dk</a>>:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<div bgcolor="#ffffff" text="#000000">Yes, that looks right.<br><br>You must also refresh the map (refresh/pan/zoom/etc.) in the browser via javascript.<br><br>In addition to my other suggestions, you can also check the error log for messages.
<div><span><br><pre cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre><br><br>saloua wakrim skrev:
<blockquote type="cite">
<div>hi! please i want know if this code is that what all i must do for adding new layer to map and see it in viewer frame or i must do some relation with the feature source i create in my code?? thanks on advance</div>
<div> </div>
<div><font size="2">
<p>myLayer = </p></font><font color="#0000ff" size="2">New</font><font size="2"> MgLayer(layerDefId, resourceSrvc)
<p>myLayer.SetName(myLayerName)</p>
<p>myLayer.SetLegendLabel(myLayerName)</p>
<p>myLayer.SetDisplayInLegend(</p></font><font color="#0000ff" size="2">True</font><font size="2">)
<p>myLayer.SetSelectable(</p></font><font color="#0000ff" size="2">False</font><font size="2">)
<p>map.GetLayers().Insert(0, myLayer)</p></font><font size="2">
<p>myLayer.ForceRefresh()</p></font><font size="2">map.Save(resourceSrvc)</font><br><br> </div>
<div class="gmail_quote">2009/5/10 Kenneth Skovhede, GEOGRAF A/S <span dir="ltr"><<a href="mailto:ks@geograf.dk" target="_blank">ks@geograf.dk</a>></span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<div bgcolor="#ffffff" text="#000000">The code looks alright.<br>Do you refresh the map afterwards?<br>What is in the "insertResults" ? <br>(There can be a hidden error, due to a bug in MapGuide)<br>Are you sure that the LayerDefinition matches the FeatureSource?<br>
Try to create the FeatureSource and LayerDefinition in "Library://" instead,<br>so you can examine the layer from Studio/Maestro.<br><pre cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre><br><br>saloua wakrim skrev:
<blockquote type="cite">
<div>
<div>
<div>i try the following code for displaying layer wich contains line in map, so i digitize a line, create temporary feature for this line, create a layer wich contains it and add it to the map. it doesn't give me some error but i can see the line in the map (i can draw it). Please help me. the code is following:</div>
<div> </div>
<div> <font color="#008080" size="2">
<p>String</p></font><font size="2">dataSource = </font><font color="#800000" size="2">"Session:"</font><font size="2"> + sessionid1 + </font><font color="#800000" size="2">"//"</font><font size="2"> + myLayerName + </font><font color="#800000" size="2">".FeatureSource"</font><font size="2">; </font><font color="#008080" size="2">MgResourceIdentifier</font><font size="2"> dataSourceId = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#008080" size="2">MgResourceIdentifier</font><font size="2">(dataSource); </font><font color="#008080" size="2">MgFeatureService</font><font size="2"> featureSrvc = (</font><font color="#008080" size="2">MgFeatureService</font><font size="2">)siteConnection.CreateService(</font><font color="#008080" size="2">MgServiceType</font><font size="2">.FeatureService); </font><font color="#0000ff" size="2">if</font><font size="2"> (DoesLayerExist(myLayerName, map) == </font><font color="#0000ff" size="2">false</font><font size="2">)
<p>{</p>
<p> </p></font><font color="#008000" size="2">//create Feature Source </font><font color="#008080" size="2">MgClassDefinition</font><font size="2"> myClassDef = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#008080" size="2">MgClassDefinition</font><font size="2">();
<p>myClassDef.SetName(myLayerName);</p>
<p>myClassDef.SetDescription(myLayerName + </p></font><font color="#800000" size="2">" Feature Source"</font><font size="2">);
<p>myClassDef.SetDefaultGeometryPropertyName(</p></font><font color="#800000" size="2">"SHPGEOM"</font><font size="2">); </font><font color="#008080" size="2">MgDataPropertyDefinition</font><font size="2"> prop = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#008080" size="2">MgDataPropertyDefinition</font><font size="2">(</font><font color="#800000" size="2">"KEY"</font><font size="2">);
<p>prop.SetDataType(</p></font><font color="#008080" size="2">MgPropertyType</font><font size="2">.Int32);
<p>prop.SetAutoGeneration(</p></font><font color="#0000ff" size="2">true</font><font size="2">);
<p>prop.SetReadOnly(</p></font><font color="#0000ff" size="2">true</font><font size="2">);
<p>myClassDef.GetIdentityProperties().Add(prop);</p>
<p>myClassDef.GetProperties().Add(prop);</p>
<p>prop = </p></font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#008080" size="2">MgDataPropertyDefinition</font><font size="2">(</font><font color="#800000" size="2">"ID"</font><font size="2">);
<p>prop.SetDataType(</p></font><font color="#008080" size="2">MgPropertyType</font><font size="2">.Int32);
<p>myClassDef.GetProperties().Add(prop);</p></font><font color="#008080" size="2">MgGeometricPropertyDefinition</font><font size="2"> geomProp = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#008080" size="2">MgGeometricPropertyDefinition</font><font size="2">(</font><font color="#800000" size="2">"SHPGEOM"</font><font size="2">);
<p>geomProp.SetGeometryTypes(</p></font><font color="#008080" size="2">MgFeatureGeometricType</font><font size="2">.Curve);
<p>myClassDef.GetProperties().Add(geomProp);</p></font><font color="#008080" size="2">MgFeatureSchema</font><font size="2"> schema = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#008080" size="2">MgFeatureSchema</font><font size="2">(myLayerName + </font><font color="#800000" size="2">"Schema"</font><font size="2">, myLayerName + </font><font color="#800000" size="2">"SchemaDesc"</font><font size="2">);
<p>schema.GetClasses().Add(myClassDef);</p></font><font color="#008080" size="2">MgCreateSdfParams</font><font size="2"> sdfParams = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#008080" size="2">MgCreateSdfParams</font><font size="2">(</font><font color="#800000" size="2">"MGA-56 (GDA94 / MGA zone 56)"</font><font size="2">, map.GetMapSRS(), schema);
<p>featureSrvc.CreateFeatureSource(dataSourceId, sdfParams);</p>
<p> </p>
<p> </p></font><font color="#008000" size="2">//create layer </font><font color="#008000" size="2">//String layerDef = "Session:" + sessionid1 + "//" + myLayerName + ".LayerDefinition";</font><font size="2"> </font><font color="#008080" size="2">MgResourceIdentifier</font><font size="2"> layerDefId = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#008080" size="2">MgResourceIdentifier</font><font size="2">(</font><font color="#800000" size="2">"Library://essaicalque/Redline.LayerDefinition"</font><font size="2">);
<p> </p>
<p> </p></font><font color="#008080" size="2">MgByteSource</font><font size="2"> content = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#008080" size="2">MgByteSource</font><font size="2">(</font><font color="#800000" size="2">@"C:\Program Files\MapGuideOpenSource\WebServerExtensions\www\essaiselect2\Layerdef.xml"</font><font size="2">);
<p>resourceSrvc.SetResource(layerDefId, content.GetReader(), </p></font><font color="#0000ff" size="2">null</font><font size="2">); </font><font color="#008000" size="2">//code enlev‚ d'ici: ajouter layer resource … la carte</font><font size="2"> </font><font color="#008000" size="2">//il faut ajouter l'autre code: add layer resource to map</font><font size="2"> </font><font color="#008000" size="2">//DOMDocument domdoc = new DOMdocument();</font><font size="2"> </font><font color="#008080" size="2">MgLayer</font><font size="2"> result=add_layer_resource_to_map(layerDefId,resourceSrvc,myLayerName,myLayerName,map);
<p>}</p></font><font color="#008080" size="2">MgInsertFeatures</font><font size="2"> insertFeatures = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#008080" size="2">MgInsertFeatures</font><font size="2">(myLayerName, makeLine(</font><font color="#800000" size="2">"1"</font><font size="2">, x0, y0, x1, y1)); </font><font color="#008080" size="2">MgFeatureCommandCollection</font><font size="2"> commands = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#008080" size="2">MgFeatureCommandCollection</font><font size="2">();
<p>commands.Add(insertFeatures);</p></font><font color="#0000ff" size="2">int</font><font size="2"> commandIndex = commands.IndexOf(insertFeatures); </font><font color="#008080" size="2">MgPropertyCollection</font><font size="2"> insertResults;
<p>insertResults = featureSrvc.UpdateFeatures(dataSourceId, commands, </p></font><font color="#0000ff" size="2">false</font><font size="2">); </font><font color="#008080" size="2">MgLayer</font><font size="2"> myLayer1 = map.GetLayers().GetItem(myLayerName) </font><font color="#0000ff" size="2">as</font><font size="2"> </font><font color="#008080" size="2">MgLayer</font><font size="2">;
<p>myLayer1.ForceRefresh();</p>
<p> </p></font><font color="#008000" size="2">//commands.Add(new MgInsertFeatures(myLayerName,makeLine("1", x0, y0, x1, y1)));
<p> </p></font><font size="2">
<p>map.Save(resourceSrvc); </p>
<p> </p><font color="#0000ff" size="2">
<p><</p></font><font color="#800000" size="2">script</font><font size="2"> </font><font color="#ff0000" size="2">runat</font><font color="#0000ff" size="2">=server></font><font size="2"> </font><font color="#008080" size="2">Boolean</font><font size="2"> result; </font><font color="#008080" size="2">MgPropertyCollection</font><font size="2"> makeLine(</font><font color="#008080" size="2">String</font><font size="2"> Name, </font><font color="#008080" size="2">Double</font><font size="2"> x0, </font><font color="#008080" size="2">Double</font><font size="2"> y0, </font><font color="#008080" size="2">Double</font><font size="2"> x1, </font><font color="#008080" size="2">Double</font><font size="2"> y1)
<p>{ </p></font><font color="#008080" size="2">MgPropertyCollection</font><font size="2"> PropertyCollection = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#008080" size="2">MgPropertyCollection</font><font size="2">(); </font><font color="#008080" size="2">MgInt32Property</font><font size="2"> nameProperty = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#008080" size="2">MgInt32Property</font><font size="2">(</font><font color="#800000" size="2">"ID"</font><font size="2">, 1);
<p>PropertyCollection.Add(nameProperty); </p></font><font color="#008080" size="2">MgWktReaderWriter</font><font size="2"> wktReaderWriter = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#008080" size="2">MgWktReaderWriter</font><font size="2">(); </font><font color="#008080" size="2">MgAgfReaderWriter</font><font size="2"> agfReaderWriter = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#008080" size="2">MgAgfReaderWriter</font><font size="2">(); </font><font color="#008080" size="2">MgGeometry</font><font size="2"> geometry = wktReaderWriter.Read(</font><font color="#800000" size="2">"LINESTRING XY ("</font><font size="2"> + x0 + </font><font color="#800000" size="2">" "</font><font size="2"> + y0 + </font><font color="#800000" size="2">","</font><font size="2"> + x1 + </font><font color="#800000" size="2">" "</font><font size="2"> + y1 + </font><font color="#800000" size="2">")"</font><font size="2">) </font><font color="#0000ff" size="2">as</font><font size="2"> </font><font color="#008080" size="2">MgLineString</font><font size="2">; </font><font color="#008000" size="2">//MgGeometry geometry = wktReaderWriter.Read("LINESTRING(3 4,10 50,20 25)") as MgLineString; </font><font color="#008080" size="2">MgByteReader</font><font size="2"> geometryByteReader = agfReaderWriter.Write(geometry); </font><font color="#008080" size="2">MgGeometryProperty</font><font size="2"> geometryProperty = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#008080" size="2">MgGeometryProperty</font><font size="2">(</font><font color="#800000" size="2">"SHPGEOM"</font><font size="2">, geometryByteReader);
<p>PropertyCollection.Add(geometryProperty); </p></font><font color="#0000ff" size="2">return</font><font size="2"> PropertyCollection;
<p>} </p></font><font color="#008080" size="2">
<p>Boolean</p></font><font size="2">DoesLayerExist(</font><font color="#008080" size="2">String</font><font size="2"> LayerName, </font><font color="#008080" size="2">MgMap</font><font size="2"> Map)
<p>{ </p></font><font color="#008080" size="2">MgLayerCollection</font><font size="2"> layers = Map.GetLayers();
<p>result = (layers.Contains(myLayerName));</p></font><font color="#0000ff" size="2">return</font><font size="2"> result;
<p>}</p></font><font color="#008080" size="2">MgLayer</font><font size="2"> add_layer_resource_to_map(</font><font color="#008080" size="2">MgResourceIdentifier</font><font size="2"> layerresourceid, </font><font color="#008080" size="2">MgResourceService</font><font size="2"> rs, </font><font color="#008080" size="2">String</font><font size="2"> layername, </font><font color="#008080" size="2">String</font><font size="2"> layerlegendlabel, </font><font color="#008080" size="2">MgMap</font><font size="2"> map)
<p>{</p></font><font color="#008080" size="2">MgLayer</font><font size="2"> myLayer = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#008080" size="2">MgLayer</font><font size="2">(layerresourceid, rs);
<p>myLayer.SetName(layername);</p>
<p>myLayer.SetLegendLabel(layerlegendlabel);</p>
<p>myLayer.SetDisplayInLegend(</p></font><font color="#0000ff" size="2">true</font><font size="2">);
<p>myLayer.SetSelectable(</p></font><font color="#0000ff" size="2">true</font><font size="2">);
<p> </p></font><font color="#0000ff" size="2">if</font><font size="2"> (!map.GetLayers().Contains(layername))
<p>{</p>
<p>map.GetLayers().Insert(0, myLayer);</p>
<p>}</p>
<p>myLayer.SetVisible(</p></font><font color="#0000ff" size="2">true</font><font size="2">);
<p>myLayer.ForceRefresh();</p>
<p>map.Save(resourceSrvc);</p></font><font color="#0000ff" size="2">return</font><font size="2"> myLayer;
<p>}</p></font><font color="#0000ff" size="2">
<p></</p></font><font color="#800000" size="2">script</font><font color="#0000ff" size="2">></font>
<p> </p>
<p> </p>
<p> </p></font></div></div></div><pre><hr width="90%" size="4">
_______________________________________________
mapguide-users mailing list
<a href="mailto:mapguide-users@lists.osgeo.org" target="_blank">mapguide-users@lists.osgeo.org</a>
<a href="http://lists.osgeo.org/mailman/listinfo/mapguide-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>
</pre></blockquote></div><br>_______________________________________________<br>mapguide-users mailing list<br><a href="mailto:mapguide-users@lists.osgeo.org" target="_blank">mapguide-users@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/mapguide-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a><br>
<br></blockquote></div><br><pre><hr width="90%" size="4">
_______________________________________________
mapguide-users mailing list
<a href="mailto:mapguide-users@lists.osgeo.org" target="_blank">mapguide-users@lists.osgeo.org</a>
<a href="http://lists.osgeo.org/mailman/listinfo/mapguide-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>
</pre></blockquote></span></div></div><br>_______________________________________________<br>mapguide-users mailing list<br><a href="mailto:mapguide-users@lists.osgeo.org" target="_blank">mapguide-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapguide-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a><br><br></blockquote></div><br><pre><hr width="90%" size="4">
_______________________________________________
mapguide-users mailing list
<a href="mailto:mapguide-users@lists.osgeo.org" target="_blank">mapguide-users@lists.osgeo.org</a>
<a href="http://lists.osgeo.org/mailman/listinfo/mapguide-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>
</pre></blockquote></div></div></div><br>_______________________________________________<br>mapguide-users mailing list<br><a href="mailto:mapguide-users@lists.osgeo.org" target="_blank">mapguide-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapguide-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a><br><br></blockquote></div><br><pre><hr width="90%" size="4">
_______________________________________________
mapguide-users mailing list
<a href="mailto:mapguide-users@lists.osgeo.org" target="_blank">mapguide-users@lists.osgeo.org</a>
<a href="http://lists.osgeo.org/mailman/listinfo/mapguide-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>
</pre></blockquote></div></div></div><br>_______________________________________________<br>mapguide-users mailing list<br><a href="mailto:mapguide-users@lists.osgeo.org" target="_blank">mapguide-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapguide-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a><br><br></blockquote></div></div></div><br></blockquote></div><br>