title: Solr4 spatial troubleshooting polygons
body: <p>I am trying  to troubleshoot Solr4 and its spatial capabilities.
  I have a document indexed with a field “geo”.</p>
  
  <p>In it I have the following</p>
  
  <p>Latitude  -34.7413</p>
  
  <p>Longitude 149.7102</p>
  
  <pre><code>Stored as &lt;geo&gt;-34.741328,149.710238&lt;/&gt;
  </code></pre>
  
  <p>I have also tried indexing the same document as </p>
  
  <pre><code>&lt;geo&gt; 149.710238 -34.741328 
  </code></pre>
  
  <p>which is suggested if you are not comma separating the values (reverse  the lat/long order and put a space between the values).</p>
  
  <p>The docs index just fine.</p>
  
  <p>I am attempting  to send it a polygon search. The polygon is a triangle shape and if you can imagine the below 3 points of the triangle are in clockwise order. It’s a very large triangle with the target coordinate in the middle somewhere. I chose a triangle in the hopes of a simple debug, I intend to have much more complicate shapes drawn for these searches</p>
  
  <pre><code>(-34.580136904223494, 149.6165823974609)
  
  (-34.84203933395146, 150.0175833740234)
  
  (-34.84654761634415, 149.4627738037109)
  </code></pre>
  
  <p>I have sent Solr the following queries and get errors.</p>
  
  <pre><code>fq=geo:"Intersects(POLYGON(-34.5801 149.6165, -34.8420 150.0175, -34.8465 149.4627))" 
  </code></pre>
  
  <p>My attempt at a triangle.</p>
  
  <pre><code>fq=geo:"Intersects(POLYGON(-34.5801 149.6165, -34.8420 150.0175, -34.8465 149.4627, -34.5801 149.6165))"
  </code></pre>
  
  <p>My attempt at a triangle adding the last co ordinate again in order to “close” the polygon.
  The above 2 queries return no results only the following error.</p>
  
  <p>ERROR 500
  Unable to read: POLYGON(-34.5801 149.6165, -34.8420 150.0175, -34.8465 149.4627, -34.5801 149.6165)</p>
  
  <p>My question I guess is where to first look? I have JTS library installed. Solr Log records this.</p>
  
  <pre><code>19:11:50
  
  SEVERE
  
  SolrDispatchFilternull:com.spatial4j.core.exception.InvalidShapeException: Unable to read: POLYGON((-34.5801 149.6165, -34.8420 150.0175, -34.8465 149.4627))
  </code></pre>
  
  <p>Thanks for any pointers anyone can provide. I think the problem is either a solr config issue, somehow something isn’t installed right, the way im sending it coordinates and shapes, or something else I am missing.</p>