How to create layers in layar¶
Layar is one of the most successful AR project. Layar offers the possibility to 3rd parties to include his layers into layers developing a very simple API. So, the number of layers supported by layer increase very fast, and hard job is done by other companies that want to be inside layar.
This could be a good feature for LibreGeoSocial. But, how does it works? Very, very easy... that is the key of success.¶
1. You have to register an account in the Layar webpage: http://publishing.layar.com/publishing/requestaccount/
2. You describe your layer
3. The most important thing. You have to give an url with the webservice (in your side) that returns the contents of your layer.
This is the key, external developers only have to implement 1 service!!! And this will be a RESTFull service supporting a GET request. Mandatory parameters: ¶
- layerName - The name of the layer defined on the publishing site.
- lat - The latitude of the position where the user/phone is located.
- lon - The longitude of the position where the user/phone is located.
- radius - The search range within which POIs should be returned.
Ok, this is quite similar to how layers works in LibreGeosocial, but, we also have keywords and categories to make the search.
How 3rd parties design his data model? Again, very simple model to store contents, and very focused in the information to be showed:¶
CREATE TABLE IF NOT EXISTS `POI_Table` ( `id` int(50) NOT NULL auto_increment, `attribution` varchar(50) default NULL, `title` varchar(50) default NULL, `lat` decimal(20,10) default NULL, `lon` decimal(20,10) default NULL, `imageURL` varchar(255) default NULL, `line4` varchar(50) default NULL, `line3` varchar(50) default NULL, `line2` varchar(50) default NULL, `type` int(11) NOT NULL default '0', `actions` varchar(50) default NULL, `dimension` int(1) NOT NULL default '1', `alt` int(10) default NULL, `relativeAlt` int(10) default NULL, `transform` int(10) default NULL, `object` int(10) default NULL, `distance` decimal(20,10) default NULL, PRIMARY KEY (`id`) )
Then, the response in the webservice is quite obvious:¶
- layer: String; The name of the layer.
- errorCode: Integer; 0 is ok. Use any error code between 20 and 29 to return a custom error message that will be displayed to the end-user.
- errorString: String; The corresponding error message returned back to the user, visible in the AR view.
- hotspots: Array of POIs; A list of returned POIs information.
And they also use Json.
What do we need in LGS? (Some bullet points, ideas, feedback expected) :¶
- I like the idea of having only one method to implement. In fact, LGS layers and channels searches works with only one function. But, we also have an api to get icon, info, categories. No problem, this functions get the information from the LGS layer database. In the case of 3rd party layers, this info will be full filled when the user register his own layer.
- What happens with the categories? I think 3rd parties dont want to think on categories. Layar only have POI (point of interest). This simplify the data model to 3rd parties that dont need to clasify the information. * POI could be supported by GeoNotes in LGS.
- Who register a new layer? A regular user registered in LGS? new users, new models? Layar gives developers a "developer key" to use for the requests.
- Supports LGS layers models 3rd parties layers without modifications in the data base? Yeees, we have a layer type, in this case, we will have 3rd party layer type that make the request in an specified url. The layers model in LGS is quite robust.
- Of course, how about the "paid layers"? ok ,ok, I have to read more about it...