[mapguide-users] Select a point and make sql query

Jackie Ng jackie.ng at aecsystems.com.au
Mon Jan 14 17:47:10 EST 2008

A high level overview is..

In your php script, load $currentselection into an MgSelection object,
generate a filter off of that selection, 

Create a MgFeatureQueryOptions object that contains this filter, and pass it
to the SelectFeatures() method of MgFeatureService. This returns an
MgFeatureReader that contains all the features in the selection set. 

Then iterate through the MgFeatureReader, getting the geometry component of
each feature (which is an MgByteReader).

Pass this MgByteReader to the Read() method of an MgAgfReaderWriter
instance, which will return an MgGeometry object (this is the geometry of
your selected feature(s))

Then call GetCentroid() on this MgGeometry object, to get the selected
point. Now you can pass this to your SQL query.

- Jackie

JeromeA wrote:
> Hi,
> as you know I'm quite new to MG and php %-|. So here is my question.
> I want to select a point on my map and send its information to a php
> script to make a database query. How does it work with the invoke url? I
> want to send e.g. the id of the selected point to the php and  make a
> "normal" sql query like $sql= Select * from xy where id=$currentselection.
> Is that possible or how do I have to realize this?
> Thanx for your help, 
> Jerome
> MGE 2008 trial on Windows Server 2003 with IIS and PHP
> MG Studio 2008 trial on Win XP.

View this message in context: http://www.nabble.com/Select-a-point-and-make-sql-query-tp14713713s16610p14817984.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

More information about the mapguide-users mailing list