We are using Solr 3.3 with Solr.NET and we have put a dynamic "location_p" location type field on our documents and now we need the ability to do spatial searches.
I have got the radius searches (distance from a given point) working like this;
{!geofilt sfield=location_p pt=33.882518712472255,-84.05531775646972 d=1.7}
Now we need the ability to do a Polygon squery to get all documents with the "location_p" field 'inside' a given set of Points (something along the lines of the Polygon search capabilities of ElasticSearch).
This is really different than the BBox query filter as the points of the Polygon are not symmetrical, more random based on user 'click' points.
Any ideas or suggestions would be appreciated.
As far as I know Solr doesn't currently implement polygon spatial search.
There are a couple of efforts towards implementing this (SOLR-2155, SOLR-2268). Try applying one of these patches, test it, contribute to the project.
There's also Spatial Solr plugin, which implements polygon search but is only compatible with Solr 1.4.
See also http://wiki.apache.org/incubator/SpatialProposal
Related
I have a list with nearly 100,000 GPS coordinates in lat/long format in a CSV file. A lot of these are only a few inches away from each other, so I would like to merge them somehow, or filter those out that are too close together within a certain radius.
Do you guys know of a script or a service that can do this automatically?
There is a reference to a nice paper that explains how to find nearest lat/lng points inside a specified bounding box in another thread, which you can find here: latitude/longitude find nearest latitude/longitude - complex sql or complex calculation
Here is the direct link to the paper: Geo Distance Search with MySQL
I think you can adapt the idea from the paper to your domain in order to set up a filter procedure.
I followed several example about geospatial support in Redis. I tried to add POINT features to my Redis dataset without any problem, and subsequently I can query POINT names within certain radius (in meters, km, miles) of a certain coordinate (or a certain member of POINT).
The next immediate feature i need to try is POINT-in-POLYGON query. Now I am curious :
Does Redis geo have the capability for storing polygon?
If yes, does this polygon capability come as native or need another stack of software/extension?
I think it is still not possible to store polygons with redis geospatial.
But I found an article explaining how to load a custom lua script to query points (stored in redis) within a polygon. The GEOSEARCH command allows you to do that for a bounding box out of the box if it is enough for you.
I have the following use case:
I want to be able to search my lucene documents within a certain circle of radius x kms from the given user lat long.
I also want to sort the documents by distance.
I also need the distnace values later on to display to user.
Which spatial strategy would be best for me without indexing anything extra and considering performance.
According to your requirements, I think the best choice could be the PointVectorStrategy, which is the simplest one and also satisfy your conditions:
Simple SpatialStrategy which represents Points in two numeric fields.
The Strategy's best feature is decent distance sort.
Characteristics:
Only indexes points; just one per field value.
Can query by a rectangle or circle.
SpatialOperation.Intersects and SpatialOperation.IsWithin is supported.
Requires DocValues for SpatialStrategy.makeDistanceValueSource(org.locationtech.spatial4j.shape.Point)
and for searching with a Circle.
Yes, it will require you to have DocValues indexed, but if I understand correctly, none of the spatial strategies will be provide needed functionality for free.
I have come across a problem that I 've never solved before but I find it frequently implemented in various apps so I would like to ask if there is a common way to solve it. I have a set of analytics data each representing some logging action (i.e. info, warn etc). Each of this items has a location and a type (i.e. action). There can be millions of these items per area (depending on the area size or map zoom).
I am looking for the best way to store this set of data in my database. I am very comfortable with SQL Server but dont mind what db I have to use as long as it can handle the scalability requirements. If Amazon WS offers such a product or some other cloud solution then even better cause thats how we are planning to host this app. Google maps will be used to visualize the data.
Some requirements:
Be able to plot all data for a given map rectangle (a common google
map interface with markers representing the logging actions)
Be able to zoom in/zoom out and get relevant data for the new map rectangle
Be able to "group" markers in one bigger marker if data are very close. For instance, if point A is 1 km away from point B and I am seeing a map of 10 km radius then I should see two independent points, A and B. But if I zoom out to 500 km radius then point A and B are too close to each other so I would like to group them in one marker. Hopefully that's possible.
If SQL Server is not a good solution then a free, very cheap or cloud-based storage solution should be recommended (no I cant afford an Oracle).
All the queries above should be able to come back within milliseconds or somehow to be cached. Queries will be of the kind: Get me all analytics data for the given map window with zoom of the given rectangle latitude/longitude.
Thanks,
Yannis
If I undertsood correctly, there are 2 sides to your question:
1- A Database System, that supports storage and lookup of spatial data. Many of the free/open source RDBMS have spatial extensions: MySQL and Postgres (PostGIS) in particular. Spatial data are stored like any other data with the addition of spatial geometry attribute, which describes the shape of your data instance (point, rectangle, polygon, ellipse, ...). You can query spatial data entities, with spatial filters. And of course, spatial queries support joints and unions and almost all kind of SQL constructs.
2- A client/server api that would support rendering of spatial data (with the usual functions such as zoom in, zoom out, pan, etc.), caching and drill-down. As far as I know, there isn't one api that support all these features together, out the box. But there are some interesting apis that you might want to investigate.
Hope this helps.
What is the correct way to implement a custom ranking algorithm for Solr/Lucene?
I read about Zvents implementing a Distance Weighting ranking system for documents which correspond to events in a specific geographic area (http://www.lucidimagination.com/Community/Hear-from-the-Experts/Articles/Zvents).
I would like to do something similar: I index ads in different cities and I would like to boost the relevance of nearest ads given a specific location.
Local Lucene is a project meant to add local search to Lucene. Basically, you add spatial coordinates to the index fields. You then have to decide, based on your index structure, whether it is better to first search according to textual matches and then filter by geographic location, or the other way around. Lucene in Action has an example of a spatial result filter. The forthcoming second edition will probably have more in that direction. See also the LocalSolr wiki page.