<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,4 @@
+logging
 public/stylesheets/compiled/*
 notes
 .DS_Store</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -9,35 +9,45 @@ require 'world_boundaries.rb'
 
 class IndexController &lt; ApplicationController
 
+  #
+  # generate rss - with country boundary respect if supplied
+  #
   def rss
-    @country = 'Iraq'
-    @country = params[:country] if params[:country]
-    @multipolygon = WorldBoundaries.polygon_country(@country)
-    @w,@e,@s,@n = WorldBoundaries.polygon_extent(@multipolygon)
-    synchronous = false
-    results = QuerySupport::query(@q,@s,@w,@n,@e,synchronous)
     @posts = []
-    results[:results].each do |result|
-      next if result.kind != Note::KIND_POST
-      if WorldBoundaries.polygon_inside?(@multipolygon,result.lon,result.lat)
-        @posts &lt;&lt; result
+    @country = nil
+    @country = params[:country] if params[:country] &amp;&amp; params[:country].length &gt; 1
+    if @country
+      @multipolygon = WorldBoundaries.polygon_country(@country)
+      if @multipolygon
+        @w,@e,@s,@n = WorldBoundaries.polygon_extent(@multipolygon)
+        synchronous = false
+        results = QuerySupport::query(@q,@s,@w,@n,@e,synchronous)
+        results[:results].each do |result|
+          next if result.kind != Note::KIND_POST
+          if WorldBoundaries.polygon_inside?(@multipolygon,result.lon,result.lat)
+            @posts &lt;&lt; result
+          end
+        end
       end
     end
     headers[&quot;Content-Type&quot;] = &quot;application/xml; charset=utf-8&quot;
     render :layout =&gt; false
   end
 
-  def test
-    x1,x2,y1,y2 = WorldBoundaries.extent('Iraq')
-    @testresult = WorldBoundaries.inside?('Iraq',100,100)
-    render :layout =&gt; nil
-  end
-
   #
   # The client side is javascript so this does very litle
   #
   def index
 
+    @country = nil
+    @country = params[:country] if params[:country] &amp;&amp; params[:country].length &gt; 1
+    if @country
+      @multipolygon = WorldBoundaries.polygon_country(@country)
+      if @multipolygon
+        params[:w],params[:e],params[:s],params[:n] = WorldBoundaries.polygon_extent(@multipolygon)
+      end
+      @map.countrycode = @country
+    end
 
     # strive to supply session state of previous question if any to the map for json refresh
     @map.question = nil
@@ -68,20 +78,42 @@ class IndexController &lt; ApplicationController
     # preferentially pull user question and location of question; ignore session state
     @q = nil
     @q = session[:q] = params[:q].to_s if params[:q]
+
+    # always grab the explicit bounds if any - can be overloaded 
     @s = @w = @n = @e = 0.0
-	begin
-		@s = session[:s] = params[:s].to_f if params[:s]
-		@w = session[:w] = params[:w].to_f if params[:w]
-		@n = session[:n] = params[:n].to_f if params[:n]
-		@e = session[:e] = params[:e].to_f if params[:e]
-	rescue
-	end
+    begin
+      @s = session[:s] = params[:s].to_f if params[:s]
+      @w = session[:w] = params[:w].to_f if params[:w]
+      @n = session[:n] = params[:n].to_f if params[:n]
+      @e = session[:e] = params[:e].to_f if params[:e]
+    rescue
+    end
+
+    # allow explicit country code to set boundaries - overrides supplied bounds
+    @country = nil
+    @country = params[:country] if params[:country] &amp;&amp; params[:country].length &gt; 1
+    if @country
+      @multipolygon = WorldBoundaries.polygon_country(@country)
+      if @multipolygon
+        @w,@e,@s,@n = WorldBoundaries.polygon_extent(@multipolygon)
+      end
+    end
 
     # pull user search term if supplied
     synchronous = false
     synchronous = true if params[:synchronous] &amp;&amp; params[:synchronous] ==true
     results = QuerySupport::query(@q,@s,@w,@n,@e,synchronous)
 
+    # finalize the culling
+    if @multipolygon
+      temp_results = []
+      results[:results].each do |result|
+        if WorldBoundaries.polygon_inside?(@multipolygon,result.lon,result.lat)
+          temp_results &lt;&lt; result
+        end
+      end
+      results[:results] = temp_results
+    end
 
     render :json =&gt; results.to_json
   end</diff>
      <filename>app/controllers/index_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -73,7 +73,7 @@ class WorldBoundaries &lt; ActiveRecord::Base
   end
 
   def self.polygon_country(country_name)
-    country = WorldBoundaries.find(:first, :conditions =&gt; [ &quot;cntry_name = ?&quot;, country_name ] );
+    country = WorldBoundaries.find(:first, :conditions =&gt; [ &quot;name = ?&quot;, country_name ] );
     return country
   end
 </diff>
      <filename>app/models/world_boundaries.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,10 +12,14 @@
     %h3 Places
     %ul
       %li Palestine
-      %li Iraq
-      %li Iran
-      %li Syria
-      %li Jordan
+      %li
+        %a{:href =&gt; &quot;/?country=Iraq&quot;} Iraq
+      %li
+        %a{:href =&gt; &quot;/?country=Iran&quot;} Iran
+      %li
+        %a{:href =&gt; &quot;/?country=Syria&quot;} Syria
+      %li
+        %a{:href =&gt; &quot;/?country=Jordan&quot;} Jordan
       %li United States
       %li Egypt
       %li Afghanistan
@@ -39,4 +43,4 @@
 
   #people
     %h3 People
-    #people_box
\ No newline at end of file
+    #people_box</diff>
      <filename>app/views/index/index.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -45,6 +45,7 @@ class Dynamapper
   attr_accessor :map_type
   attr_accessor :features
   attr_accessor :map_usercallback
+  attr_accessor :countrycode
 
   #
   # initialize()
@@ -60,7 +61,8 @@ class Dynamapper
     @zoom = args[:zoom] || 9 
     @map_type = &quot;G_SATELLITE_MAP&quot;
     @features = []
-	@map_usercallback = &quot;map_user_initialize&quot;
+    @map_usercallback = &quot;map_user_initialize&quot;
+    @countrycode = &quot;&quot;
   end
 
   #
@@ -739,7 +741,7 @@ function mapper_page_paint(blob) {
 function mapper_page_paint_request(recenter) {
 
 	if(map == null) return;
-	var url = &quot;/json?&quot;;
+	var url = &quot;/json?country=#{@countrycode}&amp;&quot;;
 
 	// tack on the search phrase
 	var q = document.getElementById(&quot;q&quot;);</diff>
      <filename>lib/dynamapper/dynamapper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>679193d3201a9b926b690a5a2790cc3f1a5a2f81</id>
    </parent>
  </parents>
  <author>
    <name>Anselm Hook</name>
    <email>anselm@shams.meedan.net</email>
  </author>
  <url>http://github.com/anselm/angel/commit/3f00bc786ffc123185ac7994d8431233518495da</url>
  <id>3f00bc786ffc123185ac7994d8431233518495da</id>
  <committed-date>2009-09-15T19:58:27-07:00</committed-date>
  <authored-date>2009-09-15T19:58:27-07:00</authored-date>
  <message>started to constrain the ui to only show specifally bounded regions in countries
some style improvements
teaching git to ignore compiled sheets</message>
  <tree>cc60e9bc33c6b2167e08676bd748fe645ab553bb</tree>
  <committer>
    <name>Anselm Hook</name>
    <email>anselm@shams.meedan.net</email>
  </committer>
</commit>
