[mapguide-users] Re: in fusion, after select features at server, i cann't do delete operation!

ar_gaeta ar_gaeta at yahoo.it
Mon Oct 18 11:02:03 EDT 2010


Hi all,
I'm new of MapGuide, and I would like to improve a code to delete a feature
given some parameter (this is a first step), just to start to know how work
MapGuide java code.
I write this code but it doesn't work: what it's wrong?
I have MapGuide OpenSource 2.1, with Tomcat/Apache, so I would like to write
in Java even if I'm not able.

Thanks very very much.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<%@ page import="org.osgeo.mapguide.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.text.*" %>
<%@ page import="javax.servlet.jsp.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ include file="common.jsp" %>

<%
      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);
  
      // 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;

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

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

MgLayer layer = map.GetLayers().GetItem("area");
layer.UpdateFeatures(commands);
%>
</html>
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/in-fusion-after-select-features-at-server-i-cann-t-do-delete-operation-tp1815225p5647347.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list