20

I am working on software that is very ESRI oriented, but a future version will likely not be using ESRI software. It uses Shapefiles and Geodatabases. I'm planning on getting all of my data to Shapefiles in anticipation for future versions of the software that will likely be on Android and other mobile devices. It appears that Shapefiles are the most common datatype for features in the open-source GIS world, but what are the others, and what benefits do they bring? I'm familiar with GeoJSON and KML, but I'm sure there are others.

I would like to know all options, but I am particularly interested in dataset types best suited for storing on mobile devices (the data must be accessible without an internet connection).

closed as too broad by PolyGeo Oct 20 '17 at 0:51

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
  • 1
    That question from 2011 was asked before GeoPackage existed and answers naturally do not include that alternative. – user30184 May 4 '17 at 21:24
  • 2
    Esri File Geodatabase has a maximum length of char field that would rival the text content of most small libraries, Esri Personal Geodatabase supports very long text fields also. Both can be accessed via QGIS and of course Esri ArcGIS but support for these data types is limited outside of these packages. Beware of version though, I would try creating 9.3 compliant as most Esri software you're likely to encounter will be 10+ and the geodatabase APIs for QGIS should support this version. GeoJSON and KML also can support large text fields but aren't as universally readable. – Michael Stimson Oct 19 '17 at 21:43
  • 1
    Umm, 9.3 is not a good plan for file geodatabase compatibility -- The FGDB API doesn't support 9.x-style .gdb. – Vince Oct 19 '17 at 23:04
  • 1
    @ElioDiaz shapefiles still exist, despite their limitations, as they are the most universal feature transference media - almost every GIS package opens or can import Esri shapefile. The format is an open standard so anybody can read and implement in their own way. There are undoubtedly superior GIS feature formats but they are not as universally adopted... this topic has been discussed many times on GIS.SE. As much as we would wish it otherwise shapefiles are likely to be the lowest common denominator for features for some time yet so we just need to grin and bear it. – Michael Stimson Oct 19 '17 at 23:57
18

As @user890 says, this very much depends on how the data will be used. Mainly there are two ways you could access the data:

  1. By loading it all into memory in one go and then access/query the data in-memory.
  2. By querying for specific features, bounding boxes etc.

Formats like GeoJSON and KML are best suited for cases when you want to load everything in one go. The benefits are that the data can be structured in a way that's more suited for your application. The downsides: larger file sizes (since they are text-based) and the inability to do efficient querying directly from the file.

SQLite/Spatialite is better for querying (SQL), but it's more difficult to structure the data - you have to flatten everything into database tables and then do JOINs (which can be expensive) when querying.

There isn't really a perfect file format that will cover all (but then again shapefiles are far, far from perfect). One alternative to consider is rolling your own application-specific format, but this only works if you don't need to share the data with the outside world.

14

I think the OGR Vector Format list (link updated) identifies just about every open source format I have ever heard of, and many many more. Each of those formats has its own advantages/disadvantages, so its hard to say which is the 'best'. For mobile apps, I imagine file size will be one of the more important deciding factors.

For mobile applications, I would think sqlite/spatialite format would be the logical format to start with. I know Android provides native support for sqlite. So, assuming you can load the spatialite extensions, you will have a very powerful gis available to you.

Depending on how adventurous you are, it would appear that building gdal for android is not impossible. You could then conceivably have many more formats at your disposal. I am sure many users on this site would be interested if you went this route.

13

A new format that has come about recently is the Geopackage. This specification is built on top of the SQLite database, so it has the same single-file basis, but with the added benefit of being an OGC standard.
As to file size, it is likely that the storage format is more compact than the .shp and .dbf format for spatial and attribute data used in the Shapefile. Therefore, the GeoPackage is likely to be the same size, or smaller, than the totality of the same features in a shapefile.
This photo shows a the sewer mains in San Diego saved as both Shapefile and GeoPackage. As you can see, they are essentially the same size. Shapefile vs Geopackage Size
Since this format is based on SQLite, it should be ready-made for mobile devices. Many apps already use this database format for storage, so it is a proven technology. It can be used cross platform without any translation required.

4

Agree with Lennert, choose the right format for the job.

However I have found Spatialite to be a pretty versatile format. You have the single file giving you have the flexibility in storing and sharing data like a shapefile, but you negate the issues you mention with character limits; whilst giving you opportunity to exploit the benefits of a spatial database.

Unfortunately it isn't fully supported in ArcGIS (I haven't tried in a little while so I could be wrong), but works great in QGIS.

4

There are a lot of different formats and the best depends on your data set you have, the tools you use and the things you want to do with it.

Some of the ones I use:

  • File Geodatabase & spatialite databases: A catchall that I like to use. It can hold all sorts of data and have relationships, indexing... I use gdb when working in an Esri environment, spatialite for anything else.

  • GeoJson: Easy to read format I generally use for small datasets that don't require much in the way of indexing

  • Proper databases: I tend to use this for massive data sets and complex algorithms.

But there are tons of others as well.

3

I would recommend using SQLite/spatiallite database. It is a single file like geodatabase (one to many tables/layers within) and can be used in ArcGIS Desktop and QGIS.

  • I saved polygon data in sqlite and loaded that with QGIS, and got a message saying "CRS was undefined: defaulting to CRS EPSG:4326 - WGS84". Doesn't it lose info on projection ? – Ichiro May 4 '17 at 22:48
  • With what software did you save out the polygon layer to sqlite? – artwork21 May 5 '17 at 0:24
1

The options really depend on what language you will use and how the data will be used. Android will most likely be Java. Every option will be a kind of cost/benefit comparison based on that decision. All data formats are optimized for certain use cases.

The next question is how the data will be used. Will the mobile app just read spatial data? Or will it be reading and writing data frequently? How often will it exchange data with other devices or servers?

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