[Mapguide-users] CGI QueryMapFeatures

Chris Claydon chris.claydon at autodesk.com
Fri Jan 12 17:18:35 EST 2007

And here's a php script that uses the Feature Service's SelectFeatures
API method. It is independent of the selectability and visibility of the
corresponding layer in the map. One thing to make sure of is that the
geometry you use for the query is in the coordinate system used by the
feature source (which may differ from the map).

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

	    <title>PHP Test Page</title>
		    include 'constants.php';
		    	$thisFile = __FILE__;
				$pos = strrpos($thisFile, '\\');
				if ($pos == false)
					$pos = strrpos($thisFile, '/');
				$configFilePath = substr($thisFile, 0,
$pos+1) . "../webconfig.ini";
		        MgInitializeWebTier ($configFilePath);

				$userInfo = new
		        $siteConn = new MgSiteConnection();
                $site = new MgSite();
                $sessionId = $site->CreateSession();

				$featureSrvc =
                $resourceSrvc =

				$mapId = new

                $map = new MgMap();
                $map->Create($resourceSrvc, $mapId, "My Test Map");
                $geomWkt = "POLYGON((-180 -90, -180 90, 180 90, 180 -90,
-180 -90))";
                $wktReader = new MgWktReaderWriter();
                $geometry = $wktReader->Read($geomWkt);
                $layers = $map->GetLayers();
                $selLayer = $layers->GetItem("Hydrography");
                $featureResourceId = new
                $featureClassName = $selLayer->GetFeatureClassName();
                $geometryName = $selLayer->GetFeatureGeometryName();
                $queryOptions = new MgFeatureQueryOptions();
$geometry, MgFeatureSpatialOperations::Intersects);
                $layers = new MgStringCollection();
                $featureReader =
$featureSrvc->SelectFeatures($featureResourceId, $featureClassName,
                    $id = $featureReader->GetString("ID");
		    catch (MgException $e)
		        echo $e->GetMessage();




-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Trevor
Sent: January 12, 2007 2:28 PM
To: Scott Hameister; mapguide-users at lists.osgeo.org
Subject: RE: [Mapguide-users] CGI QueryMapFeatures

Hi Scott,

I did a quick check on the QueryMapFeatures OPERATION.  It is intended
to work with visible layers only.  Any layers not visible at the current
scale range will be excluded.

You may want to look at SELECTFEATURES instead.  It requires more in
depth knowledge of the layers and their data sources but does not depend
on view state because it goes directly against the feature source.


-----Original Message-----
From: Scott Hameister [mailto:ScottH at mPower-tech.com] 
Sent: Thursday, January 11, 2007 9:45 AM
To: Mapguide_users at lists.osgeo.org
Subject: RE: [Mapguide_users] CGI QueryMapFeatures

Is there any documentation on the FCGI OPERATIONS and params Yet?
Since the WebAPI is so wrapped around it it would be nice to no what
parameters are available...
When I goto http://localhost/mapguide/mapagent/index.html
"OPERATION=QueryMapFeatures" isn't even an option...and I'm assuming
even this site doesn't give all the options of FCGI params either.

-----Original Message-----
From: mapguide_users-bounces at lists.osgeo.org
[mailto:mapguide_users-bounces at lists.osgeo.org] On Behalf Of Scott
Sent: Wednesday, January 10, 2007 6:47 PM
To: Mapguide_users at lists.osgeo.org
Subject: [Mapguide_users] CGI QueryMapFeatures

I can't find documentation on the FCGI operation QueryMapFeatures When I
change the ViewerAPi Code where it filters by the selectable and visible
layers " LAYERNAMES=" + encodeURIComponent(GetVisSelLayers())"
To a list of Non-visible layers it doesn't work....
....I want users to be able to select features using the geometry on
layers that are not visible as well for parsing purposes? Can I use this
Operation for that

mapguide-users mailing list
mapguide-users at lists.osgeo.org

More information about the mapguide-users mailing list