Hi,
I posted this on
GIS exchange. I have a working map in a standard HTML page, however when I transfer it to Drupal using php requires, or embedding the code, I get an issue that the X coordinate is a whole number while the Y a decimal. Comparing this to my working URL the only difference in URL is the last Y coordinate which should be a whole number not a decimal.
http://xxxxxxxxxx:8080/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&LAYERS=medford:parks,RIVERFLIES_READONLY:sites_tbl&QUERY_LAYERS=medford:parks,RIVERFLIES_READONLY:sites_tbl&STYLES=&BBOX=-1.676788330078125,54.409340183768315,-0.6406402587890625,54.64841250231667&FEATURE_COUNT=10&HEIGHT=600&WIDTH=1509&FORMAT=image%2Fpng&INFO_FORMAT=text%2Fhtml&SRS=EPSG%3A4326&X=680&Y=257.4345623This is the code that works outside of drupal but causes the issue when embedded.
var popup = L.popup();
function onMapClick(e) {
var latlngStr = '(' + e.latlng.lat.toFixed(3) + ', ' + e.latlng.lng.toFixed(3) + ')';
var BBOX = map.getBounds().toBBoxString();
var WIDTH = map.getSize().x;
var HEIGHT = map.getSize().y;
var X = e.containerPoint.x;
var Y = e.containerPoint.y; var URL = '
http://10.0.10.204:8080/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&LAYERS=medford:parks,RIVERFLIES_READONLY:sites_tbl&QUERY_LAYERS=medford:parks,RIVERFLIES_READONLY:sites_tbl&STYLES=&BBOX='+BBOX+'&FEATURE_COUNT=5&HEIGHT='+HEIGHT+'&WIDTH='+WIDTH+'&FORMAT=image%2Fpng&INFO_FORMAT=text%2Fhtml&SRS=EPSG%3A4326&X='+X+'&Y='+Y;
alert(URL); popup.setLatLng(e.latlng);
popup.setContent("<iframe src='"+URL+"' width='500' height='180' frameborder='0'><p>Your browser does not support iframes.</p></iframe>");
map.openPopup(popup);
}
map.on('click', onMapClick);