Getting your data out

9 August, 2011 16:02 by Simon S

Were going to take a break from the talk about design for this post, and talk about how you get your data into the app. All the animal data is stored in a property list file called animalData.plist (imaginative, I know). The first time the app is run on a device, it creates a database and loads all the data that file.

The file doesn't just contain the animal data, it also contains the information for the taxon menu. Since thats a bit simpler than the animal data, I'll start with that. Each taxon type has three properties: taxonName, highlightedImage and standardImage. A single taxon entry appears like this

{

highlightedImage = "animalActive_05_insects@2x.png";

standardImage = "animal_05_insects@2x.png";

taxonName = "Crawly Things with 6 legs";

}

Each line is a key value pair. On the first line, highlightedImage is the key, and animalActive_05_insects@2x.png is the value. Note that each line ends with a semi-colon (;).

The property standardImage is the filename of the image displayed next to the taxon name (in this case a grey silhouette of a winged insect). highlightedImage is the filename of the image displayed next to the taxon name when the row is selected. In this case, a white silhouette of a winged insect stands out better than the grey against the blue background.

Within the plist file, the taxon types for your app are contained in an array. So, if you only had invertebrates in your app, your taxon array would look something like this.

(

{

highlightedImage = "animalActive_05_insects@2x.png";

standardImage = "animal_05_insects@2x.png";

taxonName = "Crawly Things with 6 legs";

},

{

highlightedImage = "animalActive_03_freshInvertebrates@2x.png";

standardImage = "animal_03_freshInvertebrates@2x.png";

taxonName = "Freshwater Invertebrates";

},

{

highlightedImage = "animalActive_10_spiders@2x.png";

standardImage = "animal_10_spiders@2x.png";

taxonName = Spiders;

},

{

highlightedImage = "animalActive_11_terrestrialInvertebrates@2x.png";

standardImage = "animal_11_terrestrialInvertebrates@2x.png";

taxonName = "Terrestrial Invertebrates";

},

{

highlightedImage = "animalActive_08_marineInvertebrates@2x.png";

standardImage = "animal_08_marineInvertebrates@2x.png";

taxonName = "Marine Invertebrates";

},

)

The brackets ( and ) mark the start and end of the array. It's important to note that the order of the taxon entries in the document is irrelevant; they are listed alphabetically in the menu.

The data for each animal is also listed as key value pairs. The following properties are simple key value pairs (e.g. species = sapiens)

  • biology
  • species
  • genus
  • order
  • family
  • class
  • phylum
  • diet
  • distinctive
  • distribution
  • habitat
  • identifier
  • identifyingCharacteristics
  • lcs
  • ncs
  • wcs
  • nativeStatus
  • taxonGroup
  • taxonSubgroup

The remaining properties: commonNames, audioFiles, profileImages, mapImage and squareCropImage require a little more structure.

An animal can have many names, so the value for commonName is always an array, even if there's only one entry. The first entry in the commonName array becomes the display name of the animal. So for Turdus merula, the key value pair is

commonNames = (Common Blackbird, Eurasian Blackbird,);

and the name displayed in listings is Common Blackbird.

The audioFiles, profileImages, mapImage and squareCropImage are also arrays, even though youll only have one mapImage and one squareCropImage. Each file reference has two properties, filename and credit. You can leave out the caption in the file references for mapImage and squareCropImage.

profileImages = (

{

filename=image1.jpg;

caption=Great Photographer;

},

);

mapImage = (

{

filename=map1.jpg;

},

);

When you put it all together, you get a document like this. This has been a fairly technical post, if there's anything that needs clarification, let me know in the comments.

<< A face for your field guide: Splash Screens and App Icons  |  Presto, chango >>

Comments (0)

Write your comment below All fields are required

We love receiving comments, but can’t always respond.

About this blog

We've released the source code for MV's Field Guide Project under a MIT style license. This blog will help you identify all the material you need to collect so that you can publish a field guide of your own.

MV's Open Sourced Code on Github

View all Museum Victoria's apps

Blog authors

Simon S is the programmer behind the field guide app.

Simon O is the designer behind the field guide app.