Embedding Nail


The Basics

A Nail map can easily be embedded into an existing application eg. an asset system. The core component of Nail is the map.php. This is the component that generates the map images that you see in the Nail web map. The map.php accepts URL parameters via GET parameters – this means you can tell the map.php what to do by adding parameters to the map.php URL.

For example, when you click on the following link, a map image of India will be generated:


The URL options used above tell the map.php to zoom to a map element (move=element) and that the element required is in layer 1 (the countries layer) and to look for a value of 'INDIA' in the field called 'name'. You could modify the above URL to zoom to any point, line or poly in you database.

Advanced Embedding

In the examples above, the last parameter (return=image) ensures that an image is returned directly to the browser. If you omit this parameter, a string of information (called the 'map definition') will be returned instead:


Instead of sending the map to the browser, the above URL has asked for the map to be created on the server (as a .png file). All map images that are created on the server are stored in the 'map_images' folder:


The map definition can be used to access the image from the server. The 'map definition' defines the map that has been created. You will need to write some javascript to access the map definition string, read the mapID and then append a URL to the start and a .png to the end – and you can access the image directly off the server and use it in your dynamic web app eg. within a html <img> tag.

http://www.geoit.com.au/nail_demo/map_images/#insert map ID here#.png