I have a . sqlite file with many columns, two of those columns being lat and long.

I've been searching around for a bit now (don't think I want to be using BuildCircleMbr from spatialite?) but I'm not entirely too sure how to go about it.

I'm thinking it has something to do with GeomFromText but can't get the query set up correctly.

Final product would be having these circles and display them on a map using MapServer/OpenLayers.


Yes, you will need the BuildCircleMbr. Define a SpatiaLite layer in mapfile, giving the DATA string like:

DATA "SELECT BuildCircleMbr(lat, long, radius) FROM your_table"

Create an OpenLayers.Layers.Mapserver layer (or WMS layer if you serve the mapfile in WMS) in OpenLayers js script.

  • Hi @Mingfeng, thank you for the reply. When I add that in the mapfile (and of course in OL js) I'm not getting any data on the screen (no errors in mapserver log either). More importantly, if I just run that SELECT statement I'm getting no such function: BuildCircleMbr. Does this have to do with m version of sqlite? version -v returns 3.7.5 – Nubtacular Jul 25 '13 at 21:09
  • Never used spatialite before, so I'm not sure. But did you install spatialite extension for your sqlite? – mfdev Jul 26 '13 at 11:10
  • Sorry, that was a poor question. We had spatialite on our server, but I had to install spatialite-tools. If I do the query SELECT BuildCircleMbr(lat, long, radius) FROM your_table I don't get an error but it doesn't return anything (no mapserver log error, just no POI data showing up). Also, when I access the .sqlite file from cmd line, I'm not doing sqlite3 POIs.sqlite, I'm doing spatialite POIs.sqlite. Is this ok? If I try to do a .load once inside sqlite3, I get an error: file or directory not found. – Nubtacular Jul 26 '13 at 15:38
  • If you have some tool that can execute sql statement, it's better to do the query there first instead of in mapfile, just to check if the query returns the right data. – mfdev Jul 26 '13 at 16:02
  • Right right that's what I was trying to say: I just do the query within sqlite3, I don't get an error but it doesn't return anything (not like it's going to draw a circle on the screen within sqlite3 :) ). That being said, it SHOULD be returning something right? – Nubtacular Jul 26 '13 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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