[OpenLayers-Users] WFS popup alignment

Joanne Cook j.cook at oxfordarch.co.uk
Fri Dec 5 12:22:58 EST 2008


Hi Andrew,

I did eventually figure out that it was the "spherical mercator" problem, again, though I was/am confused as to why the popup would be placed correctly yet the feature it was derived from was not!

Unfortuntely, it's not always possible to get enough access to alter the epsg file and add 900913 support for mapserver. For example, you may have access to only the web folders on a server (from personal experience). In those cases, you have to find a different solution to the problem, although of course you can use different background imagery and eschew the commercial layers...

Thanks again

Jo

-----------------------------------------------------
Joanne Cook
Senior IT Support and Development
Oxford Archaeology (North)
01524 880212
http://thehumanjourney.net

----- Original Message -----
From: "Andrew Parker" <andrew at source3.com>
To: users at openlayers.org
Sent: Thursday, 4 December, 2008 15:32:08 GMT +00:00 GMT Britain, Ireland, Portugal
Subject: Re: [OpenLayers-Users] WFS popup alignment


Hello Joanne: 

I am headed out of the office but wanted to give you something to consider....have you read: http://docs.openlayers.org/spherical_mercator/ which discusses projection issues using google, yahoo, ve, etc with user created layers. 

Also, I am working on projection issues as well. I started a post which discusses projection issues which may help you with yours. If you go to my layer intialization script ( http://webmap.rthicksconsult.com/c2corgCreateMap_projection.js ) you will see how I had to add {'shericalMercator':true}. As an example 

gsatellite = new OpenLayers.Layer.Google("Google Satellite", {type:G_HYBRID_MAP, 'sphericalMercator': true, buffer:0} );
	map.addLayer (gsatellite); 
My thread is at http://www.nabble.com/Cannot-display-search-marker-when-projecting-layers-to-EPSG-900913-td20771840.html#a20771840 . 


Hope this will give some insight to your issue. 


Andrew Parker 
Joanne Cook wrote: 

Hi List,

I have both WMS and WFS layers from a postgres table (starting with WMS but moving to WFS as you zoom in), on top of Microsoft Virtua Earth. You click the WFS points and get a framedcloud popup of the feature attribute data. This aspect works fine, but there is an issue with the alignment of the WFS points. There are some zoom levels where I can see that the WFS layer does not align correctly with the WMS, this is worse at the bottom of the map square and better towards the top. Not only that, the anchor for the popup aligns correctly with the WMS rather than the WFS. So you click on a point and the popup appears next to the correct location rather than where you have clicked.

I assume this is something to do with projections, but I'm a little stuck and would appreciate some assistance. I can't show the map itself because it isn't available to the outside world, but the salient bits of the code are here:

 var map, ve, wms, wfs, drawControls, selectControl, selectedFeature;
        function onPopupClose(evt) {
            selectControl.unselect(selectedFeature);
        }
        function onFeatureSelect(feature) {
          selectedFeature = feature;
			var projcode = selectedFeature.attributes['projcode'];
			var sitecode = selectedFeature.attributes['sitecode'];
			var projnam = selectedFeature.attributes['projnam'];
			var year = selectedFeature.attributes['year'];
            popup = new OpenLayers.Popup.FramedCloud("info", 
                                     feature.geometry.getBounds().getCenterLonLat(),
                                     null,
                                     "<div style='font-size:.8em'>Project Code: " + projcode +"<br />Site Code: " + sitecode+"<br />Project Name: " + projnam + "<br />Year: " + year + "</div>",
                                     null, true, onPopupClose);
            feature.popup = popup;
            map.addPopup(popup);
        }
        function onFeatureUnselect(feature) {
            map.removePopup(feature.popup);
            feature.popup.destroy();
            feature.popup = null;
        }    
        function init(){
            map = new OpenLayers.Map('map');
            ve = new OpenLayers.Layer.VirtualEarth( "Virtual Earth",{'type': VEMapStyle.Hybrid});
            wms = new OpenLayers.Layer.WMS("OA Sites WMS", "http://10.0.10.106/cgi-bin/mapservpostgis.cgi?" ,
                               {layers: 'oasites', transparent: true, format: 'image/png', buffer:0},
                                {isBaseLayer: false, reproject: true},
                                {scales: [14000000,500000]});
            wfs = new OpenLayers.Layer.WFS("OA Sites WFS", "http://10.0.10.106/cgi-bin/mapservpostgis.cgi?" ,
                                {typename: 'oasites', maxfeatures: 200, featureNS: ' http://mapserver.gis.umn.edu/mapserver ', typename: 'ms:oasites'},
                                {scales: [500000, 10], extractAttributes: true},
                                {style: OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style['default'])});


Thanks

Jo

-----------------------------------------------------
Joanne Cook
Senior IT Support and Development
Oxford Archaeology (North)
01524 880212 http://thehumanjourney.net ------
Files attached to this email may be in ISO 26300 format (OASIS Open Document Format). If you have difficulty opening them, please visit http://iso26300.info for more information.

_______________________________________________
Users mailing list Users at openlayers.org http://openlayers.org/mailman/listinfo/users 
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users


------
Files attached to this email may be in ISO 26300 format (OASIS Open Document Format). If you have difficulty opening them, please visit http://iso26300.info for more information.




More information about the Users mailing list