[mapguide-users] Null reference query problem:
Steve Dang
steve.dang at autodesk.com
Wed Jul 30 10:59:52 EDT 2008
Try the following:
$map = new MgMap($site);
$map->Open($mgMapName);
See http://trac.osgeo.org/mapguide/wiki/MapGuideRfc9 for more information.
Steve.
-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Dragan Podvezanec
Sent: Wednesday, July 30, 2008 4:30 AM
To: mapguide-users at lists.osgeo.org
Subject: [mapguide-users] Null reference query problem:
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.
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
More information about the mapguide-users
mailing list