[mapguide-users] Null reference query problem:

Dragan Podvezanec dragan.podvezanec at gmail.com
Wed Jul 30 06:30:26 EDT 2008


Hi all.

I want to execute custom query on one layer using PHP. $mgSessionId and
$parcel_id are passed from another page and they are ok (I checked with
echo). Here's the code:

<?php
                
                include 'constants.php';
		$mgSessionId = $_GET['SESSION'];
		$parcel_id = $_GET['parcel_id'];
		
    try
    {

        MgInitializeWebTier("$../../webconfig.ini");

        $userInfo = new MgUserInformation($mgSessionId);
        $siteConnection = new MgSiteConnection();
        $siteConnection->Open($userInfo);

        $resourceService =
$siteConnection->CreateService(MgServiceType::ResourceService);
	$featureService =
$siteConnection->CreateService(MgServiceType::FeatureService);
        $map = new MgMap();
	$mgMapName = 'map1';
        $map->Open($resourceService, $mgMapName);
		

		$queryOptions = new MgFeatureQueryOptions();
		$queryOptions->SetFilter("parcel_id = $parcel_id");

		$layer2 = $map->GetLayers()->GetItem('parcels');
		$featureReader = $layer2->SelectFeatures($queryOptions);
		

    }

?>

But this returns the following:

Null reference.Null reference. Exception occurred in method MgMap.GetService
at line 93 in file
d:\buildforgeprojects\mapguide_open_source_v2.0\build_23.8\mgdev\common\mapguidecommon\MapLayer/Map.cpp

What is wrong here?
-- 
View this message in context: http://www.nabble.com/Null-reference-query-problem%3A-tp18730412p18730412.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list