[mapguide-users] Add to point some properties (name,key).How? take a look on code.

Farah farah at egovernments.org
Tue Oct 17 04:54:42 EDT 2006


Hi..!

When u create the point itself, add a new property for the point that
corresponds to your required Id. Then when you click the point to select it,
you will have access to that property which will help you link to the
database.

For ex:
properties.Add(new MgInt32Property("TEST_ID", OrgId));




Regards
Farah

-----Original Message-----
From: Maciej Skorczewski [mailto:maciej.skorczewski at procad.pl] 
Sent: Tuesday, October 17, 2006 1:55 PM
To: users at mapguide.osgeo.org
Subject: [mapguide-users] Add to point some properties (name,key).How? take
a look on code.

hi group!

In database are stored X,Y coordinates of points (hotels,pubs etc.)

My guestion is: How to add key value or ID to point properties.
I needs this to make onclick event whit popup information about cliked 
point. If i have id or key i can get data form database.

Hove can i add this properties? My new layer is selectable, i can click 
on it and select this point. key,name whit value.
should be visible in property task.



I add new point to map by this code

//--------Creating the point

$geometryFactory = new MgGeometryFactory();

//----- x,y are from database

$coordinate = $geometryFactory->CreateCoordinateXY($x,$y);
$point = $geometryFactory->CreatePoint($coordinate);
$rs->MoveNext();

//----------Define a property collection

$geometryReaderWriter = new MgAgfReaderWriter();
$properties = new MgPropertyCollection();
$properties->Add(new MgStringProperty('Owner','Puby'));

// is any code to add properties example. key,name whit value.
// i should be visible in property task.

$properties->Add(new MgGeometryProperty('SHPGEOM', 
$geometryReaderWriter->Write($point)));

//----------Create an insert command for this property.
$parcelMarkerCommands->Add(new MgInsertFeatures('Puby', $properties));




-- 
Maciej Skorczewski



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org
For additional commands, e-mail: users-help at mapguide.osgeo.org





More information about the Mapguide_users mailing list