22

I am a long-time programmer, new to GIS. I am trying to get a feel for the database aspects of GIS and I understand that there are some databases which are specialized for GIS use. Basically I am trying to understand whether to use such a database or to stick with the hugely popular, well established, widely supported (and free) MySql.

The sort of applications I am liable to code would things like:

  • fleet management (land or ocean based vehicles)
  • employee tracking
  • inventory control (at a granularity of a physical position accurate to with a metre or so)
  • errm, that's about it, really

I would normally expect to be tracking no more than 1 few hundred (maximum, possibly a few thousand) items. Sometimes the items will be located in the same (large) building, series of building, city, country or world-wide, depending on the application.

I will occasionally be visually representing them either on a custom floor plan of a building or, more likely, in Google Earth or the like (more of which in another question).

It seems to me that I am as well off with MySql and adding columns for lat/long or other positional data, but that might just be because I know MySql.

Is there any reason why I should be looking at a more specialized database?

3 Answers 3

13

The real advantage to spatial databases (PostGIS, spatial extensions to MySQL or anything else) is that you can do spatial operations on spatial data. If you are just storing point coordinates, then you don't really gain much from spatial (just use two numerical columns). If you store combinations of point coordinates (where the customers are), and line coordinates (where the delivery trucks go), and polygons (sales regions), and then do queries that relate those various bits of information (how many customers within a sales zone, how many trucks traveled less than 2km from a customer site today but did not make a delivery or pickup), you can gain a lot.

As pointed out by iant, PostGIS is certainly worth a look for a server application. SpatiaLite is the spatial extensions to SQLite, which may be a better fit for a desktop / embedded / offline mobile application, while offering fairly similar SQL functions [Disclosure: I work on SpatiaLite], noting that there is nothing that stops you using PostGIS in a desktop application.

7
  • +1 and thanks. Just curios as to why it was based on Sqlite and not MySql ... Sep 29, 2012 at 1:55
  • 1
    I think its just different design goals (embedded, no configuration, etc).
    – BradHards
    Sep 29, 2012 at 3:03
  • +1 that was what I thought (I come from an embedded background too). Thanks for the info. I expect that I will end up with browser based apps (most of us will, even if we would prefer not to), so the "lite" is not so necessary. Just cursious, what sort of apps now where the d/b is in the embedded system/device? (sorry, still learning) Sep 30, 2012 at 10:36
  • 1
    embedded is a big area, but offline mobile seems to be an emerging area.
    – BradHards
    Sep 30, 2012 at 22:31
  • 2
    @Mawg Most modern phones and browsers use sqlite as the datastore. It really is one single c file, and the API is super simple and it runs inprocess. Contrast that with MySQL which requires multiple processes running and a client/server architecture. Two very different uses cases Oct 2, 2012 at 22:46
8

You should certainly consider the hugely popular, well established, widely supported (and free) PostGIS. It will do every thing that MySQL can do and handle spatial locations as first class objects. Thus you can carry out selections based on points with in a bounding box (or other polygon) without having to write out all the comparisons etc.

Once you start to need to ask questions like which objects are in which country (or building) then PostGIS really comes into it's own and should you decide that you need to map your objects then all the popular open source tools will talk to PostGIS out of the box.

7
  • +1 and many thanks. I am off to look into it now. Form a coders point of view I want to see hos well it talks to PHP if I go web based, and if I go Widnwos desktop app then I am using AnyDac database access components for Delphi, so I will email AnyDac support. Thanks again! Sep 27, 2012 at 8:29
  • 1
    To Mawg: I still have to see any of the 3rd party delphi database libs to support any of the GIS functionality in postgis, db2, spatiallite, sql server etc. Seems like that is something you have to do on your own. Sep 27, 2012 at 11:40
  • +1 @UffeKousgaard I only found this at $295 for the cheapest cartovcl.com Oct 4, 2012 at 1:52
  • 1
    Cartovcl (which I have been using for almost 10 years) is a flat file GIS SDK which has the GIS functionality built-in. It is not a thin API on top of a spatially enabled remote database. Oct 4, 2012 at 6:13
  • 1
    Historical document :-) But TatukGIS is probably one of the most comprehensive all-round GIS SDK's out there (but also a bit expensive). But it is in the same league as cartovcl, i.e. gis-functionality is built-in, it is not an API on top of a remote database. Oct 4, 2012 at 9:20
2

To add to the answers and reiterate some points, one uses a spatially-enabled database if you have queries that relate to the spatial relations of the data, a few of which are the following:

  1. which points are within x kilometers of my points of interest
  2. which points are nearer
  3. how far a point is from other point
  4. which points are x kilometers within the access road

If such queries relating to WHERE is a significant feature for an application, then usually it strongly recommended to use a spatial database.

Of course, one can resort to coding / application logic for some of this queries, such as using the distance formula for 1, but one does not need to reinvent the wheel.

Your Answer

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

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