[mapguide-users] Re: Inserting features in PostGIS fails

ar_gaeta ar_gaeta at yahoo.it
Mon Oct 18 12:04:49 EDT 2010


I'm still using the OsGeo.PostGIS provider version 3.4.
I will install the new version as soon as I can.

My problem is really too deep: I have all the example-files provided by
Autodesk in .php (like in the Developer's guide), but I'm working with Java,
and I don't know very well both languages.
My final goal is to allow on-line editing to the feature sources.
I've read the guide "Editing Data Online with the Autodesk MapGuide
Enterprise API" by Dongjin Xing, but I lose myself somewhere...
Could I ask you a pleasure? I've written this code in .jsp just to delete a
simple polygon feature from a SDF file called "area", based on the attribute
"name = 'primo'".
But something is wrong it seems I'm not able to "communicate" with the site.
Could you give it a look please? It's an application that I would like to
start from the task pane:

<%
      String sessionId = request.getParameter("SESSION");
      String mapName = request.getParameter("MAPNAME");
      MapGuideJavaApi.MgInitializeWebTier(webconfigFilePath);

      // Get the user information using the session id,
      // and set up a connection to the site server.
      MgUserInformation userInfo = new MgUserInformation(sessionId);
      MgSiteConnection siteConnection = new MgSiteConnection();
      siteConnection.Open(userInfo);
      MgSite site = new MgSite();
      site.Open(userInfo);
  
      // Get an instance of the required service(s).
      MgResourceService resourceService = (MgResourceService)
siteConnection.CreateService(MgServiceType.ResourceService);
  
      MgMap map = new MgMap();
      map.Open(resourceService, mapName);

MgFeatureService featureService =
site.CreateService(MgServiceType.FeatureService) as MgFeatureService;

String featureSourceName = "Session:sessionId//area.FeatureSource";
//MgResourceIdentifier fdo = new
MgResourceIdentifier("Library://prova_basic/Data/area.FeatureSource");
MgResourceIdentifier fdo = new MgResourceIdentifier(featureSourceName);
	
MgDeleteFeatures deleteFeature1 = new
MgDeleteFeatures("area","nome='primo'");

MgFeatureCommandCollection commands = new MgFeatureCommandCollection();
commands.Add(deleteFeature1);

//MgLayer layer = map.GetLayers().GetItem("area");
//layer.UpdateFeatures(commands);

featureService.UpdateFeatures(fdo, commands, false);
%>

Thanks for your answer, and thanks also for your blog and your availability.

Riccardo
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Inserting-features-in-PostGIS-fails-tp1813557p5647593.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list