I am using Ruby on Rails and the Thinking-Sphinx Gem with Sphinx as the search program. I would like to have a bing map where users can draw sales boundries (just a square) and have Sphinx return all customers within the drawn squares. Is this possible? I always see Sphinx do radius queries, but nothing inside of a 4 or 5 point box.
I mentioned Rails and THinking-Sphinx just to let you guys know what I was using, although this is more of a Sphinx question than anything.
Any help is greatly appreciated!
Your latitude and longitude values are available as filterable fields/attributes (if you configure sphinx in correct way).
You can set up a "FilterFloatRange" to limit your results to be within the required bounds.
Please note that lat/lon values need to be stored as radiant values.
Sorry, pretty certain Sphinx doesn't support searching within boxes, just radius queries.
Related
I try to filter the polygons of an .osm by their area.
Now it's about swiss lakes. I extracted all the polygons using the "natural=water" filter, but I still have all the ponds of Switzerland. Therefore I try to add a filter using the area of the polygons.
How can I do it??
I have allready searched some solutions, but was unable to find good answer.
The best I found was this question but I don't know where I should execute it and if it is compatible with osm data.
Thanks for your answers
One way to solve this issue would be to use Atlas. Here are the steps you would need to follow (with links to other related SO answers inline):
Convert your OSM file to a .osm.pbf using osmosis
Load the .osm.pbf into an Atlas file, using atlas-shell-tools's pbf2atlas subcommand
Write a small Java class that opens the Atlas file, gets all the lakes using a TaggableFilter, and then filters them by area, using Polygon.getSurface().
I need to store and give out long/lat coordinates and display on google maps. I would need to store points, lines, and polygons. Then add metadata on them to for generating info.
Currently looking into postgis, and it seems a fair bit to absorb. Now I'm wondering if I need to delve into it.
Is it advisable to use a spatial database for the said purpose? or using float/decimal columns for long/lat is fine?
Currently looking into postgis, and it seems a fair bit to absorb. Now I'm wondering if I need to delve into it. Is it advisable to use a spatial database for the said purpose? or using float/decimal columns for long/lat is fine?
It is a lot to absorb. Storing as a float/decimal gets you nothing. Nothing at all. Spatial functions require spatial types. You gotta learn it. You don't have to learn all of it, but you have to learn it. And, it's not too hard to get started.
CREATE TABLE foo(id,geom)
AS
VALUES ( 1, ST_MakePoint(long,lat)::geography );
Etc.
I highly suggest PostGIS in Action 2nd Edition
If the only thing you need is store and give out, then float/decimal columns would be more than enough. However, if you are querying for spatial relations (whether a point is located within a polygon, whether polygons intersect etc.), you'd better to use either PostGIS or, for instance, MySQL extensions for spatial data.
I added mongodb store and published layer on geoserver and can see feature on getFeatureInfo() but when use cql fiter openlayer do not show anything.
Can someone help me?
Im not sure if this helps but Ive had a look at the geotools-mongoDB unsupported module (which I assume your using) for my own project. Ive found theres alot of problems with it. For example it sometimes performs Long or Double mongo queries with strings which returns no results and it has a habit of ignoring AND queries etc. This might be the reason you arnt getting anything back.
I am discovering mongodb, looks nice but i am still wondering if it can solve my needs.
The question is that we have 16 million point data and we want to cross some part of it with polygons to get statistics (how many points in each polygon).
Basic geometries would be cell degrees (1 degree, 0.5 degree...) covering all the world. In that case the $within function would work, right?
But I wonder, how do I insert these geometries (coming from a shapefile) inside mongodb? Till now I was using postgreSQL-postGIS, and for that I have a lot of tools, but for mongodb...I am also wondering if more complex geometries could be inserted and queried against points.
MongoDB only provides JSON as result, right? if we want to plot some hundreds of points it would be no problem, but hundreds of thousands to be converted to vectorial data via javascript... is for this reason that WMS services are useful, as they provide one image.
Any hope to connect mongodb to any WMS? I saw someone announcing a plugin for Geoserver but it makes a year ago and nothing happened since then.
In case it is not possible, about how many GeoJSON features can be plotted at time keeping a nice browser performance?
Not much help, but I saw a talk on someone who added MongoDB as a back end to GeoServer last year.
IIRC, he said he would open source it (if his company approved), so maybe it's worth tracking him down.
EDIT: Looks like he got approval. Dug up some code here but not sure where associated documentation is. The Geotools/opengeo mailing list is where I found that.
I'm also starting to investigate using NoSQL for geographic data.
There is an article
The example code Python, PyMongo and the OGR libraries to convert shapefiles to a MongoDB collection and vice versa.
Lets say that I have gps coordinates for 1000 stores and a short text to each one. What would be the best way to store this information? SQL? One more thing to consider is how to load the information into the app. It don't seem to be a smart thing to load everything direct, the best way seems to be loading the stores in the specific area but how do I search for those stores? Is that easy to do in SQL? As you see I don't have so much experience of database programming.
storing in SQLite3 file would be best for the moment as you have lots of data and through a db, you can fetch the required data (via query) back on demand.
as for the getting stores of specific area - assuming you want to locate nearby stores within 10 KM of radius.
This will not be hard to fetch from db.
I am no server expert but can give you a guideline which will work:-
you will be having current lat/long, you will have lat/long in the table as well for each row.
may be a server guy could help you create you a query with formula where you can fit the distance calculation formula in 'where' clause's condition and you will get the records of nearby (10 KMs) places records.