5

I have a (potentially) large data set stored in MongoDB. Each record is just lat, lon and some float-point value. Each pair of lat and lon is unique, but the whole set is not covering the Earth, there may be regions with no data at all (so they're not stored).

I need to draw my own tiles based on this data, where mentioned value displayed with respective color (say, from black for minimal values to white for maximal). My dataset is changing in time, so I have to re-render tiles periodically.

I've installed GDAL but I can't find a way to fetch the data.

I've tried to export points to XYZ format, but got no luck: gdal2tiles.py doesn't want to work with it (I think the cause is that my coords are not sequential: I found a sample XYZ data set in Internet, and it was converted OK, and the only difference is that file had a value for each node in grid). Maybe it will work if I populate my database with some initial values for each possible coords pair, but it will cost much time, disk space and DB performance, so it's the last resort.

How can I make this stuff work? What am I doing wrong? Is there something to read that will help me?

3
  • 1
    Is geokoder.com/mongodb-plugin-for-quantum-gis A QGIS MongoDB plugin useful to you?
    – Mapperz
    Commented May 25, 2012 at 13:40
  • Actually, there's no issue related to Mongo, because, obviuosly, I need to somehow export the data. I can even switch to another data store, if it's needed. But, anyway, I'll try to set the things up with QGIS server. Thanks for an idea.
    – at8eqeq3
    Commented May 25, 2012 at 17:04
  • Oops. Looks like QGIS is not good to me. It, of course, imports my data (MongoDB plugin is useless because it's ignoring the 3rd field, but CSV import works fine) and even beautifully renders it. But (sorry, I didn't mentioned it in the question) my data set is changing in time, so I have to re-render tiles periodically. QGIS requires me to do this by hands with the desktop app (dump all data from remote server, import into QGIS, render tiles and publish them back). It's not what I'm looking for.
    – at8eqeq3
    Commented May 25, 2012 at 18:19

1 Answer 1

1

So, as I haven't found any existing solution, I've made my very own bycicle. It's a ruby script (actually, language and most of implementation details are no matter) that (surprise!) selects a square region from MongoDB and draws a tile. Geospatial index on points collection and a query like this:

pts = $points_collection.find({"coords" => {"$within" => {"$box" => [[start_x, start_y], [end_x, end_y]]}}}).to_a

where end_* is mostly start_* + 256, are doing the thing. To draw my tiles I'm currently using RMagick, but it gives very poor performance when drawing dot-by-dot, so I plan to switch to any other PNG rendering library.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.