Difference between revisions of "Place Maps"
(No difference)
|
Latest revision as of 03:18, 8 June 2010
Contents
Background
Place maps are displayed in two places in the PhpGedView software package:
- In the Place Hierarchy under the Lists menu.
- Place Map will be displayed here only if you are not using GoogleMaps functionality. GoogleMaps, if enabled, displays a region map in its place, depending on its coordinates in the GoogleMaps table.
- In an editing window, when adding a location to an event if the Gedcom has this option enabled.
- To enable this feature, Log in as the administrator, Click "Manage GEDCOMS and edit Privacy", Click "Edit" for the configuration file of the Gedcom you wish to change, Expand the "Edit Options", and set "Split places in Edit mode" to "Yes".
Each full map should have three files.
- The image must be in gif format.
- A htm file should contain the html code for the image map to allow the counties/provinces to be selected with a mouse click.
- A txt file should contain the list of all sub-areas in the map to allow autocompletion in the events editor.
Steps
If you are creating a new top level (Country) image map, you will first have to find the three letter country code for the country. The letters are defined by the ISO in IS0 3166 alpha-3. The UN has an up-to-date copy in their Statistics Department. Create a new directory with these three letters as the name in the places directory of your PhpGedView installation.
If you are creating a map of a state or province of a country which has already been made, you will need to name all documents with the format COU_State.xxx where COU is the three letter country code, State is the name of your state or province and xxx is either htm, gif, or txt.
Image File
Find a good image of the country or state you wish to add, copyright free images are best to use if you can find them. Open the file in a good image editor and resize it to less than 400 pixels wide. Create a new raster layer and trace the countries borders and the borders of the counties within. After deleting the original layer, you should be left with a hand traced copy of the original. Now you can add some colors to the counties and text label the names if you like. The choice of colors when coloring a map is up to personal preference. Some color all counties the same color, and some color counties so no two adjacent counties have the same color. If attempting the latter, you'll need to select four complimentary colors. All maps can be colored with a minimum of 4 colors. Finally, select all areas outside of the country and set them to a transparent color. Save the image in gif format.
Text File
The text file is just a list of all the regions within this map. If you are creating a US state map, this will be a list of the counties within that state. Each county must be on a new line of the text file.
HTM File
The htm file should be in the following format with the proper county names inserted:
<map name="COUNTRY_State"> <area shape="poly" coords="" href="javascript:setPlaceState('County 1');" alt="County 1" title="County 1"> <area shape="poly" coords="" href="javascript:setPlaceState('County 2');" alt="County 2" title="County 2"> . . . </map>
The easiest method to create this file is to use the text file you created above. If you have a UNIX or LINUX system, open the file in vim and type the following:
:%s/\(.*\)/<area shape="poly" coords="" href="javascript:setPlaceState('\1');" alt="\1" title="\1">/g
This regular expression will replace each line in the file with the county name inserted correctly in the area tag. Next, add the opening and closing <map> tag and save it as COU_State.htm
The last step is to match the coordinates of each county to the county name. Use your image editing software to get the coordinates of the corners of the counties. Type the pixel numbers into the coords attribute of each county in the following format:
coords="X1,Y1,X2,Y2,X3,Y3,..."
Limitations and Code Modifications
The events editor only displays country level maps. The place hierarchy will display two levels of maps, country and province, or country and state for example. To allow the place hierarchy to display a third level, add the following code to placelist.php for version 3.3.5:
Change line 132 to
if ($level==1 || $level==2 || $level==3) {
change the else block at line 158 to:
else {
if ($level==3) { // added to support county level
$level2 = str_replace("/ /","-", $parent[1]);
$level3 = str_replace("/ /","-", $parent[2]);
$mapfile = $maplang . "_" . $level2 . "_" . $level3 . ".htm";
if (!file_exists(filename_encode($mapfile))) $mapfile = $imgfile . "_" .$level2 . "_" . $level3 . ".htm";
if (!file_exists($mapfile)) $mapfile = $imgfile . ".htm";
$imgfile = $imgfile . "_" . $level2 . "_" . $level3 . ".gif";
$maplist = $country . "_" . $level2 . "_" . $level3;
$mapname = $parent[1];
}
else {
$level2 = str_replace("/ /","-", $parent[1]);
$mapfile = $maplang . "_" . $level2 . ".htm";
if (!file_exists(filename_encode($mapfile))) $mapfile = $imgfile . "_" . $level2 . ".htm";
if (!file_exists($mapfile)) $mapfile = $imgfile . ".htm";
$imgfile = $imgfile . "_" . $level2 . ".gif";
$maplist = $country . "_" . $level2;
$mapname = $parent[1];
}
}
To allow the event editor to display second level maps:
Related Pages
Hierachial Place List, Administrators Guide, Entering Place Data