My digital home
Mar 2011
District-level Nepal Map PHP API. Generates variable-sized map of Nepal with user defined colors for districts.
Source and example: https://github.com/jwalanta/NepalMapAPI
Demo (with maphilight jQuery plugin): http://diyaalo.com/nepalmapapi/

<?php
// Include the library and create object:
include("nepalmap.php");
$map = new NepalMap();
// Set options:
// set image width
$map->setWidth(1000);
// set stroke color array(r,g,b) and width
$map->setStroke(array(0,0,0), 2);
// set fill color for districts
// array format "district_name"=>array(r,g,b)
$map->setDistrictFillColor(array("kathmandu"=>array(255,0,0),
"lalitpur"=>array(100,0,0)));
// generate map!
$map->generateMap(); // sends to browser
// or,
$map->generateMap("/path/to/file.png"); // saves as file
?>
getImageWidth(), getImageHeight() - Returns maps width and height
htmlAreaCode() - Returns html code to be used with