MapServer uses PROJ.4 (https://trac.osgeo.org/proj/) for projection management. This library does not exist by default with the Spherical Mercator projection (EPSG:900913) defined. Such a projection is commonly used by commercial map API providers, such as GoogleMaps, Yahoo! Maps, and Microsoft Bing, and can provide excellent base layers for your maps.
For this recipe, we need to have under consideration the following:
- Due to security restrictions in JavaScript, it is not possible to retrieve information from remote domains using XMLHttpRequest. You will encounter this issue in the recipe when you send a WMS GetFeatureInfo request to a GeoServer that is typically running on Tomcat at port 8080 and also send a request from an HTML page running on Apache or ISS at port 80. Therefore, unless you run your GeoServer instance using HTTPD URL rewriting, the solution is to create a proxy script.
- Copy the proxy script included in the book dataset to the web cgi directory of your computer (in Linux, at /usr/lib/cgi-bin/, in macOS, at /Library/WebServer/CGI-Executables, and in Windows, at C:\ms4w\Apache\cgi-bin), open the proxy.cgi file, and add localhost:8080 to the allowedHosts list.