lucene - Solr 4 Spatial Search polygon vs polygon search with distance parameter -
is there way search polygon in x distance indexed polygons?
i have indexed polygons , multipolygons in solr 4.2.1 index field type
<fieldtype name="location_rpt" class="solr.spatialrecursiveprefixtreefieldtype" spatialcontextfactory="com.spatial4j.core.context.jts.jtsspatialcontextfactory" disterrpct="0.001" maxdisterr="0.000009" units="degrees" />
and can simple intersects queries
fq=geo_location:"intersects(polygon((-0.141964 51.515580, -0.130119 51.516648, -0.129261 51.515900)))"
so need:
search polygon+distance in index full of polygons
, search point+distance(a circle) in index full of polygons
point + distance (a circle) supported: http://wiki.apache.org/solr/solradaptersforlucenespatial4
ex: geo_location:"intersects(circle(4.56,1.23 d=0.0710))"
polygon + distance buffering polygon said distance , doing standard intersects. jts has geometry.buffer() operation quite easy use -- it's method call. hope 1 day expose somehow in spatial4j (this year likely), accessible higher levels -- solr. in mean time, can use jts @ client code buffer polygon , submit polygon solr search.
keep in mind through jts works in 2d space; doesn't know geodesics (i.e. doesn't account fact world sphere). spatial4j wraps jts geometries add dateline wrap support that's it. might want consider using map projection if data conveniently in 1 part of world. can reduce skewing effects. example of skewing effects occur if don't buffered polygon half way equator pole buffered east-west half as buffered north-south. if don't store points in solr in projection, client project query polygon locally (at center of polygon), buffer it, un-project lat-lon space. dramatically reduce skewing if there lot of points on polygon. if query polygon doesn't have many vertices, artificially add them. stuff i'm talking in paragraph stuff hope add 1 day it's automatic.
Comments
Post a Comment