Chapter 8

Creating Filters and 2D Objects


  • How to add filtering options
  • How to extend database tables
  • How to add 2D objects to the layer

In the previous chapter, you created your first layer. You now have the database configured and you should be familiar enough with MySQL to be able to add new POIs and add actions to your POIs. In this chapter, you will build upon your knowledge of Layar by adding advanced functionality (such as radio buttons or checkboxes to filter content). Before you begin, make sure you’ve read Chapter 7.


Since you may want to keep the layer you created in the previous chapter, make a copy of your work by taking a copy of the mylayar.php file. For the sample code used in this chapter, I have created a new layer with the name aprealestate by copying the mylayer.php file created in the previous chapter to create a new file called realestate.php. As you upload the new realestate.php file, remember the URL because this will be the endpoint you enter when you create the layer.

Also remember that the name you give to the layer needs to be unique. Since I have already taken aprealestate, you will need to create a layer with a slightly different name.

In the Layar Dashboard you should create a new layer using the settings shown in Table 8-1.

TABLE 8-1: Configuration for the real estate layer

Layar name Unique ...

Get Professional Augmented Reality Browsers for Smartphones: Programming for junaio, Layar, and Wikitude now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.