- Home
- Coding concepts
- Special screens
- Available features
- More
- Translation
- Testing
- Deployment
- Differences in Locify 0.8.5
- Sample services
- Example videos
Show My Location
There have been some changes in format for older versions of Locify.
See documentation for Locify 0.8.1 and older.
If you plan support for versions older than 0.8.5, you need to detect client version and serve correct screen.
This sample service allows user to get his position and view it on on-line maps. Service supports Google Maps, Yahoo Maps and Mapy.cz. Google Maps and Yahoo Maps are opened in internal browser, Mapy.cz are opened in external browser. This service also uses settings for remembering default map provider. Service acquire information about width and height of user's cell phone using variable $client[width] and $client[height] - it is used for generating map of right size.
Welcome message
<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:locify="http://client.locify.com/locify_ns/1.0" xml:lang="en" lang="en"> <head> <title>Show my location</title> </head> <body class="serviceInfo"> <div> <p class="description">This service enables user to view his position on Google, Yahoo or Seznam Maps using external browser.</p> <img src="http://www.locify.com/images/icons/location.png" class="icon" alt="" /> <a href="http://services.locify.com/showmylocation/start" class="firstScreen">firstScreen</a> <a href="http://services.locify.com/showmylocation/settings" class="settings">settings</a> </div> </body> </html>
Settings screen
<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:locify="http://client.locify.com/locify_ns/1.0" xml:lang="en" lang="en"> <head> <title>Show My Location settings</title> </head> <body class="form"> <form action="locify://serviceSettings" method="post"> <locify:variables> <locify:element name="mapProvider" value="$settings[mapProvider]" /> </locify:variables> <fieldset> <label>Default map provider: <select name="mapProvider"> <option value="0" selected="selected">Google maps</option> <option value="4">Google satellite</option> <option value="5">Google hybrid</option> <option value="6">Google terrain</option> <option value="1">Yahoo maps</option> <option value="2">Mapy.cz</option> <option value="3">OpenStreetMap.org</option> </select></label><br /> <input type="submit" value="Save" /> </fieldset> </form> </body> </html>
First screen
<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:locify="http://client.locify.com/locify_ns/1.0" xml:lang="en" lang="en"> <head> <title>Show My Location</title> </head> <body class="form"> <form action="http://labs.locify.com/showmylocation/submit?width=$client[width]&height=$client[height]" method="post"> <locify:variables> <locify:element name="latitude" value="$lat" /> <locify:element name="longitude" value="$lon" /> <locify:element name="mapProvider" value="$settings[mapProvider]" /> </locify:variables> <fieldset> <label>Latitude: <input type="text" name="latitude" value="" /></label><br /> <label>Longitude: <input type="text" name="longitude" value="" /></label><br /> <label>Map provider: <select name="mapProvider"> <option value="0" selected="selected">Google maps</option> <option value="4">Google satellite</option> <option value="5">Google hybrid</option> <option value="6">Google terrain</option> <option value="1">Yahoo maps</option> <option value="2">Mapy.cz</option> <option value="3">OpenStreetMap.org</option> </select></label><br /> <input type="submit" value="Show map" /> </fieldset> </form> </body> </html>
Answer to submitted form in first screen
This example shows the position on maps if user is located at coordinates N 50° E 14° and have selected:
Google Maps
<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:locify="http://client.locify.com/locify_ns/1.0" xml:lang="en" lang="en"> <head> <title>My Location at Google Maps</title> </head> <body> <div> <img src="http://maps.google.com/staticmap?markers=50.0,14.0&size=220x290&maptype=mobile&key=Locify-google-key" alt="Google Map"> </div> </body> </html>
Yahoo Maps
<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:locify="http://client.locify.com/locify_ns/1.0" xml:lang="en" lang="en"> <head> <title>Show My Location</title> <meta http-equiv="refresh" content="0;url=http://maps.yahoo.com/print.php?ard=1&mlt=50.0&mln=14.0&resize=s&mag=2&zoomin=yes&ovx=220&ovy=222&ds=n" /> </head> <body> </body> </html>
Mapy.cz
<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:locify="http://client.locify.com/locify_ns/1.0" xml:lang="en" lang="en"> <head> <title>Show My Location</title> <meta http-equiv="refresh" content="0;url=http://wap.mapy.cz/search?from=&query=50.0+14.0&mapType=ophoto&zoom=16" /> <locify:call url="locify://external/http://wap.mapy.cz/search?from=&query=50.0+14.0&mapType=ophoto&zoom=16" /> </head> <body> </body> </html>
