title: StackExchange Polygon using C#
body: <p>is there any StackExchange quicker way to validate if the point is in the Polygon using Redis.</p>
  <p>I have a Latitude and Longitude point and want to know in which city it falls. I have the polygon data for the cities.</p>
  <p>Currently I am using this code and it works, but i find it too inefficient and not scaleable when i have to check among hundreds of City Polygons.
  Would like to use Redis to do this.</p>
  <p>Please assist.</p>
  <pre><code>    City1.Add(new GeoPoints(5.9581, 1.11865));
      City1.Add(new GeoPoints(4.99572, -1.47411));
      City1.Add(new GeoPoints(6.19298, -2.00145));
      City1.Add(new GeoPoints(6.98422, 0.38257));
      City1.Add(new GeoPoints(5.9581, 1.11865));
  
      City2.Add(new GeoPoints(-6.4461, 39.11052));
      City2.Add(new GeoPoints(-7.19336, 39.68732));
      City2.Add(new GeoPoints(-7.23151, 38.98969));
      City2.Add(new GeoPoints(-7.00528, 38.55296));
      City2.Add(new GeoPoints(-6.4461, 39.11052));
  
  
  public bool IsPointInPolygon(List&lt;GeoPoints&gt; poly, GeoPoints point)
  {
      int i, j;
      bool c = false;
      for (i = 0, j = poly.Count - 1; i &lt; poly.Count; j = i++)
      {
          if ((((poly[i].Lt &lt;= point.Lt) &amp;&amp; (point.Lt &lt; poly[j].Lt))
                  || ((poly[j].Lt &lt;= point.Lt) &amp;&amp; (point.Lt &lt; poly[i].Lt)))
                  &amp;&amp; (point.Lg &lt; (poly[j].Lg - poly[i].Lg) * (point.Lt - poly[i].Lt)
                      / (poly[j].Lt - poly[i].Lt) + poly[i].Lg))
  
              c = !c;
      }
      return c;
  }
  </code></pre>