Hi Jilles,
I don't think the small circle is a solution that will work (or I miss the
point literally :)). First of all the circle shape is not (yet) supported I
guess in geo shape filtering. Secondly I don't see how a small circle will
work with WITHIN or INTERSECTS. The use case is: give me all the docs with
a polygon where the given input (search) point is part of. I think its the
opposite of the WITHIN because this will take the search shape as the shape
WITHIN the indexed documents should occur...
thus currently supported: indexed shape WITHIN filtered shape. I am
looking for: filtered shape/point WITHIN indexed shape.
The INTERSECTS looks only to shapes that are partly (overlap) covered..if I
try to build a small rectangle that is completely part of a polygon it
gives no results with INTERSECTS. See example below
INDEXED:
{"shape":{"location":{"type":"Polygon","coordinates":[[[2.0,1.0],[2.0,2.0],[1.0,2.0],[1.0,1.0],[2.0,1.0]]]},"text":"This
is my first test polygon"}}
SEARCH:
{
"filtered" : {
"query" : {
"match_all" : { }
},
"filter" : {
"geo_shape" : {
"location" : {
"relation" : "intersects",
"shape" : {
"type" : "Envelope",
"coordinates" : [ [ 1.5, 1.5 ], [ 1.6, 1.4 ] ]
}
},
"_name" : null
}
}
}
}
If I stretch the envelop to be out of the indexed polygon INTERSECTS is
working. Thus intersects only works if its part and not be part of the
indexed polygon
of course could be that your solution will work but I miss the point.
M
On Mon, Mar 4, 2013 at 2:27 PM, Jilles van Gurp jillesvangurp@gmail.comwrote:
Right, one hack here is to just use a really small circle (1 meter or so,
or even less). Polygon borders tend to be not very exact anyway and it an
error margin of one meter should be manageable.
Jilles
On Monday, March 4, 2013 1:03:29 PM UTC+1, Maarten Janssen wrote:
Hi Jilles,
Thx for your quick reply. I tried with intersects (and a point) without
luck. Even if I defined a point on the polygon line it won't find it.
I also was thinking about using a circle/rectangle but the problem than
is what should be the size of the circle? I mean it could be that multiple
polygones are part of the defined circle (or if my radius is to small I
still wouldn't find one).
thx for the library reference that is useful.
M
Op maandag 4 maart 2013 12:33:58 UTC+1 schreef Jilles van Gurp het
volgende:
You should probably use intersects. The point intersects with the
polygon. As noted in my earlier post, within is disappearing from the API
apparently.
Another trick is to convert the point into a circle polygon. I do this
for faking radius search. BTW. I have a library for doing stuff like this
on github: https://github.com/**jillesvangurp/geotoolshttps://github.com/jillesvangurp/geotools
Jilles
On Monday, March 4, 2013 12:16:42 PM UTC+1, Maarten Janssen wrote:
Hi,
I am looking for a solution for searching a point (lat/lon) in a
polygon. Currently I am able to find (indexed) polygons by specifying a
bounding box where the index polygon is in (with option WITHIN). But I need
the opposite. I indexed polygons in my documents. Now I want all documents
back based on query/filter with just a point (lat/lon). In other words give
me all the documents where a given point is withing the (indexed) polygons.
How can I do this with ES?
thx in advanced.
Maarten Janssen
--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
Maarten Janssen
CTO Infohubble
Email: mjanssen@infohubble.com
URL: www.infohubble.com
Mobile: +31620006790
Card: eee.am/mjanssen
Address:
Infohubble BV
Gebouw Sevilla
Entrada 304
1096 ED Amsterdam
The Netherlands
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.