Database Reference
In-Depth Information
map.getBounds().toBBoxString();
var WIDTH = map.getSize().x;
var HEIGHT = map.getSize().y;
var X =
map.layerPointToContainerPoint(e.layerPoint).x;
var Y =
map.layerPointToContainerPoint(e.layerPoint).y;
// compose the URL for the request
var URL = ms_url +
'SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&LAYERS=countries&QUERY_LAYERS=countries&BBOX='+BBOX+'&FEATURE_COUNT=1&HEIGHT='+HEIGHT+'&WIDTH='+WIDTH+'&INFO_FORMAT=text%2Fhtml&SRS=EPSG%3A4326&X='+X+'&Y='+Y;
//send the asynchronous HTTP request
using jQuery $.ajax
$.ajax({
url: URL,
dataType: "html",
type: "GET",
success: function(data) {
var popup = new L.Popup({
maxWidth: 300
});
popup.setContent(data);
popup.setLatLng(e.latlng);
map.openPopup(popup);
}
});
}
7. Your HTML file should now look like the leaflet.html file contained in
data/chp09 . You can now deploy this file to your web server (that is,
ApachehttpdorIIS).IfyouareusingApachehttpdinLinux,youcouldcopy
the file to the /var/www/data directory , and if you are using Win-
dows, you could copy it to C:\ms4w\Apache\htdocs\data (create the
datadirectoryifitisnotalreadyexisting).Then,accessitwiththeURL ht-
tp://localhost/data/leaflet.html .
8. Open the web page using your favorite browser and start navigating the
map—zoom,pan,andtrytoclickonapointtoidentifyonefeaturefromthe
countries PostGIS layer—as shown in the following screenshot:
Search WWH ::




Custom Search