Permalink
Browse files

Added a maps section with GeoNames map outlines for Iceland

  • Loading branch information...
1 parent 16bba4e commit 60869aeeccbf1547371a6b47c001efaee53feaad @briansuda committed Sep 7, 2011
Showing with 46,421 additions and 0 deletions.
  1. +15,638 −0 maps/Iceland/IS.txt
  2. +34 −0 maps/Iceland/altitude.php
  3. +33 −0 maps/Iceland/features.php
  4. +15,303 −0 maps/Iceland/map-lines.svg
  5. +15,303 −0 maps/Iceland/map.svg
  6. +110 −0 maps/Iceland/readme.txt
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -0,0 +1,34 @@
+<?php
+/*
+Brian Suda
+brian@suda.co.uk
+
+This is using the GeoNames database of features in Iceland to generate a line at each of the common types then the line extends at a 45 degree angle based on altitude (or population). The result is a map which you can easily see the outline of the entire country without knowledge of the actual borders.
+
+You can read more online at:
+http://optional.is/required/2010/06/28/geonames-maps/
+
+Usage:
+php altitude.php > map-lines.svg
+
+*/
+ echo '<?xml version="1.0" standalone="no"?>
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" version="1.1"
+ xmlns="http://www.w3.org/2000/svg">';
+ $f = fopen('IS.txt','r');
+ while($line = fgetcsv($f,1000,"\t")){
+ $lat = (7000-($line[4]*100))*2;
+ $long = ($line[5]*100)+3000;
+ $alt = ($line[14]/10)-1; // population
+ $alt = ($line[15]/10)-1; // altitude
+ $color = substr(md5($line[7]),0,6); // feature
+ $color = substr(md5($line[6]),0,6); // feature type
+
+ if(($line[6] != 'A') && ($line[6] != 'R') && ($line[6] != 'U')){
+ echo '<line x1="'.$long.'" y1="'.$lat.'" x2="'.($long+$alt).'" y2="'.($lat-$alt).'" style="stroke:#'.$color.';stroke-width:1"/>'."\n";
+ }
+ }
+ fclose($f);
+ echo '</svg>';
+?>
View
@@ -0,0 +1,33 @@
+<?php
+/*
+Brian Suda
+brian@suda.co.uk
+
+This is using the GeoNames database of features in Iceland to generate a point for each of the common types. The result is a map which you can easily see the outline of the entire country without knowledge of the actual borders.
+
+You can read more online at:
+http://optional.is/required/2010/06/28/geonames-maps/
+
+Usage:
+php features.php > map.svg
+
+*/
+ echo '<?xml version="1.0" standalone="no"?>
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" version="1.1"
+ xmlns="http://www.w3.org/2000/svg">';
+ $f = fopen('IS.txt','r');
+ while($line = fgetcsv($f,1000,"\t")){
+ // the 7000 and 3000 are used to help offset the results in relation to the latitude and longtude, this will vary by country
+ $lat = (7000-($line[4]*100))*2;
+ $long = ($line[5]*100)+3000;
+ $color = substr(md5($line[7]),0,6); // feature
+ $color = substr(md5($line[6]),0,6); // feature type
+
+ if(($line[6] != 'A') && ($line[6] != 'R') && ($line[6] != 'U')){
+ echo '<circle r="1" cy="'.$lat.'" cx="'.$long.'" stroke="black" stroke-width="0" fill="#'.$color.'"/>'."\n";
+ }
+ }
+ fclose($f);
+ echo '</svg>';
+?>
Oops, something went wrong.

0 comments on commit 60869ae

Please sign in to comment.