[mapguide-users] remove feature problem

jackyfox htrforum at gmail.com
Tue Sep 11 02:33:06 PDT 2012

how to remove vector feature?

body onload the map 
after that click drop down menu(onchange) remove it.
but i cant remove feature

any mistake with my code?

sample code as below:

var map, layer;
	//var url =
	//you can use this URL when MapGuide OS is installed locally
	var url = "http://localhost:8008/mapguide/mapagent/mapagent.fcgi";
	//Adjust the scale assumptions for MapGuide layers
	//Tiled layers MUST use a DPI value of 96, untiled layers can use a 
	//different DPI value which will be passed to the server as a parameter.
	//Tiled and untiled layers must adjust the OL INCHES_PER_UNIT values
	//for any degree-based projections.
	var metersPerUnit = 1;  //value returned from mapguide
	var inPerUnit = OpenLayers.INCHES_PER_UNIT.m * metersPerUnit;
	OpenLayers.INCHES_PER_UNIT["dd"] = inPerUnit;
	OpenLayers.INCHES_PER_UNIT["degrees"] = inPerUnit;
	OpenLayers.DOTS_PER_INCH = 96;    

	function init() {
	  var extent = new OpenLayers.Bounds(-180,-80,180,80);
	  var mapOptions = {
			maxExtent: extent,
			controls: [
				new OpenLayers.Control.Navigation(),
				new OpenLayers.Control.PanZoomBar(),
				new OpenLayers.Control.MousePosition()

	  map = new OpenLayers.Map( 'map', mapOptions );

	  var options = {
		 singleTile: true,
		 isBaseLayer: true,
		 visibility: true,
		 /* useAsyncOverlay: true, */ //<- remove

	  var params = {
		  mapdefinition: 'Library://sample/Maps/sample.MapDefinition'

	  var layer = new OpenLayers.Layer.MapGuide( "sample", url, params, options

	  var vectorLayer = new OpenLayers.Layer.Vector("vector layer1");
		var feature = new OpenLayers.Feature.Vector(
		 new OpenLayers.Geometry.Point(180,80),
		 {externalGraphic: 'images/car1.png', graphicHeight: 21, graphicWidth:

	  map.addControl(new OpenLayers.Control.LayerSwitcher());
	  map.setCenter(new OpenLayers.LonLat(180,80), 4);


function remove(sel){

*html part*
<body onload="init();">

<select id="sel" name="sel"

<div id="map" >   



View this message in context: http://osgeo-org.1560.n6.nabble.com/remove-feature-problem-tp5001007.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

More information about the mapguide-users mailing list