Hi List!<br><br>I'm new in OpenLayers and JavaScript :S!<br><br>I'm creating a web aplication with OpenLayers and I have two problems.<br><br>1. Why my html page don't work in InternetExplorer 6 ?<br><br>2. I need to show a pop up window with elemnts of a wfs layer and I try to override the featureClass:OpenLayers.Feature.WFS<br>
with the code I found in the UsersList but that nots works for me.<br>I show a vector points in my window, but the points are not static, if I pam or zoom in the map the points change the position.<br><br>This is my code of the Script: and any sugestion are wellcome!<br>
<br><br> // make map available for easy debugging<br> var map;<br><br> // avoid pink tiles<br> OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;<br> OpenLayers.Util.onImageLoadErrorColor = "transparent";<br>
<br><br> function init(){<br> var options = {numZoomLevels: 20,<br> projection: new OpenLayers.Projection("EPSG:900913"),<br> displayProjection: new OpenLayers.Projection("EPSG:4326")<br>
};<br> // Create a map Object<br> map = new OpenLayers.Map('map', options);<br><br> // Create Google Mercator layers<br> var gmap = new OpenLayers.Layer.Google(<br>
"Google Streets" // the default<br> );<br> var gsat = new OpenLayers.Layer.Google(<br> "Google Satellite",<br> {type: G_SATELLITE_MAP}<br>
);<br> var ghyb = new OpenLayers.Layer.Google(<br> "Google Hybrid",<br> {type: G_HYBRID_MAP}<br> );<br> var gphy = new OpenLayers.Layer.Google(<br>
"Google Physical",<br> {type: G_PHYSICAL_MAP}<br> ); <br><br>// Create a WFS Sites Layer<br> var sites = new OpenLayers.Layer.WFS( "Sites",<br>
"<a href="http://10.192.160.133/cgi-bin/mapserv.exe?map=/ms4w/apps/Test/WFS_Test.map">http://10.192.160.133/cgi-bin/mapserv.exe?map=/ms4w/apps/Test/WFS_Test.map</a>",<br> {typename: "Sites",maxfeatures: 100 },{<br>
featureClass: OpenLayers.Feature.WFS });<br><br> var sitesconsul = new OpenLayers.Layer.WFS( "Consulte des Sites",<br> "<a href="http://10.192.160.133/cgi-bin/mapserv.exe?map=/ms4w/apps/Test/WFS_Test.map">http://10.192.160.133/cgi-bin/mapserv.exe?map=/ms4w/apps/Test/WFS_Test.map</a>",<br>
{typename: "Sites",maxfeatures: 100 },{<br> featureClass: OpenLayers.Feature.WFS.Marker});<br><br><br>function DumpResult(source, result){<br> var s = "<plaintext>";<br>
s = s + source + " " + "\n";<br> for (var x in result) {<br> s = s + x + "=" + result[x] + "\n";<br> }<br><br> if (result.get_stackTrace) s = s + result.get_stackTrace() + "\n";<br>
s = s + "</pre>";<br> document.getElementById("DebugDiv").innerHTML = s;<br>}<br><br>OpenLayers.Feature.WFS.Marker = OpenLayers.Class.create();<br>OpenLayers.Feature.WFS.Marker.prototype =<br>
OpenLayers.Class.inherit( OpenLayers.Feature.WFS, {<br> <br>/**<br> * @constructor<br> *<br> * @param {OpenLayers.Layer} layer<br> * @param {XMLNode} xmlNode<br> */<br>initialize: function(layer, xmlNode) {<br> var newArguments = arguments;<br>
var data = this.processXMLNode(xmlNode);<br> newArguments = new Array(layer, data.lonlat, data)<br> OpenLayers.Feature.prototype.initialize.apply(this, newArguments);<br> DumpResult("initialize", this);<br>
this.createMarker();<br> this.marker.events.register('click', this, this.markerClick);<br> this.layer.addMarker(this.marker);<br>},<br><br>/**<br> * @param {XMLNode} xmlNode<br> *<br> * @returns Data Object with 'id', 'lonlat', and private properties set<br>
* @type Object<br> */<br>processXMLNode: function(xmlNode) {<br> //this should be overridden by subclasses<br> // must return an Object with 'id' and 'lonlat' values set<br> var point = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,<br>
"<a href="http://www.opengis.net/gml">http://www.opengis.net/gml</a>", "gml", "Point");<br> var text = OpenLayers.Util.getXmlNodeValue(OpenLayers.Ajax.getElementsByTagNameNS(point<br>
[0], "<a href="http://www.opengis.net/gml">http://www.opengis.net/gml</a>","gml", "coordinates")[0]);<br> var floats = text.split(",");<br> var gid = OpenLayers.Util.getXmlNodeValue(OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,<br>
"<a href="http://mapserver.gis.umn.edu/mapserver">http://mapserver.gis.umn.edu/mapserver</a>", "ms", "gid")[0]);<br> <br> //DumpResult("processXMLNode", text);<br>
//document.getElementById("DebugDiv").innerHTML = gid;<br> return {lonlat: new OpenLayers.LonLat(parseFloat(floats[0]),<br> parseFloat(floats[1])),id: gid, gid: gid};<br>},<br><br>/**<br>
* @param {Event} evt<br> */<br>markerClick: function(evt) {<br> DumpResult("markerClick", evt);<br> OpenLayers.Event.stop(evt);<br>},<br> <br>/** @final @type String */<br>CLASS_NAME: "OpenLayers.Feature.WFS.Marker"<br>
});<br> <br>// Create a vector layer for drawing <br>// var vector = new OpenLayers.Layer.Vector("Editable Vectors");<br> <br>
map.addLayers([gmap, gsat, ghyb, gphy, <br> //veroad, veaer, vehyb,<br> sites, sitesconsul]); //, cables]);<br> map.addControl(new OpenLayers.Control.LayerSwitcher());<br>
map.addControl(new OpenLayers.Control.ScaleLine); <br>// map.addControl(new OpenLayers.Control.EditingToolbar(vector));<br> map.addControl(new OpenLayers.Control.MousePosition());<br> if (!map.getCenter()) {map.zoomToMaxExtent()}<br>
}<br><br> function changezoom(x,y,z)<br> {<br> map.setCenter(new OpenLayers.LonLat(x, y), z);<br> } <br> function showAddress(address) {<br> var geocoder = new GClientGeocoder();<br> if (geocoder) {<br>
geocoder.getLatLng(<br> address,<br> function(point) {<br> if (!point) {alert(address + " not found");}<br> else {map.setCenter(new OpenLayers.LonLat(point.x,point.y),15);}<br>
}<br> );<br> }<br> }<br>THANKS!!!<br>