[GitHub] cordova-plugin-geolocation pull request: New PR for sample content...
Github user purplecabbage commented on the pull request: https://github.com/apache/cordova-plugin-geolocation/pull/75#issuecomment-213620416 lgtm, merged! --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-plugin-geolocation pull request: New PR for sample content...
Github user asfgit closed the pull request at: https://github.com/apache/cordova-plugin-geolocation/pull/75 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-plugin-geolocation pull request: New PR for sample content...
Github user rakatyal commented on the pull request: https://github.com/apache/cordova-plugin-geolocation/pull/75#issuecomment-210671046 LGTM. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-plugin-geolocation pull request: New PR for sample content...
Github user rakatyal commented on a diff in the pull request: https://github.com/apache/cordova-plugin-geolocation/pull/75#discussion_r59950490 --- Diff: README.md --- @@ -296,3 +311,436 @@ callback function when an error occurs with navigator.geolocation. - Returned when the device is unable to retrieve a position. In general, this means the device is not connected to a network or can't get a satellite fix. - `PositionError.TIMEOUT` - Returned when the device is unable to retrieve a position within the time specified by the `timeout` included in `geolocationOptions`. When used with `navigator.geolocation.watchPosition`, this error could be repeatedly passed to the `geolocationError` callback every `timeout` milliseconds. + + +## Sample: Get the weather, find stores, and see photos of things nearby with Geolocation ## + +Use this plugin to help users find things near them such as Groupon deals, houses for sale, movies playing, sports and entertainment events and more. + +Here's a "cookbook" of ideas to get you started. In the snippets below, we'll show you some basic ways to add these features to your app. + +* Get your coordinates. +* Get the weather forecast. +* Receive updated weather forecasts as you drive around. +* See where you are on a map. +* Find stores near you. +* See pictures of things around you. + +## Get your geolocation coordinates + +```javascript + +function getWeatherLocation() { + +navigator.geolocation.getCurrentPosition +(onWeatherSuccess, onWeatherError, { enableHighAccuracy: true }); +} + +``` +## Get the weather forecast + +```javascript + +// Success callback for get geo coordinates + +var onWeatherSuccess = function (position) { + +// We declared Latitude and Longitude as global variables +Latitude = position.coords.latitude; +Longitude = position.coords.longitude; + +getWeather(Latitude, Longitude); +} + +// Get weather by using coordinates + +function getWeather(latitude, longitude) { + +var queryString = + "http://gws2.maps.yahoo.com/findlocation?pf=1&locale=en_US&offset=15&flags=&q="; ++ latitude + "%2c" + longitude + "&gflags=R&start=0&format=json"; + +$.getJSON(queryString, function (results) { + +if (results.Found > 0) { +var zipCode = results.Result.uzip; +var queryString = "https://query.yahooapis.com/v1/public/yql?q="; + + "select+*+from+weather.forecast+where+location=" + + zipCode + "&format=json"; + +$.getJSON(queryString, function (results) { + +if (results.query.count > 0) { +var weather = results.query.results.channel; + +$('#description').text(weather.description); +$('#temp').text(weather.wind.chill); +$('#wind').text(weather.wind.speed); +$('#humidity').text(weather.atmosphere.humidity); +$('#visibility').text(weather.atmosphere.visibility); +$('#sunrise').text(weather.astronomy.sunrise); +$('#sunset').text(weather.astronomy.sunset); +} +}); +} +}).fail(function () { +console.log("error getting location"); +}); +} + +// Error callback + +function onWeatherError(error) { +console.log('code: ' + error.code + '\n' + +'message: ' + error.message + '\n'); +} + +``` + +## Receive updated weather forecasts as you drive around + +```javascript + +// Watch your changing position + +function watchWeatherPosition() { + +return navigator.geolocation.watchPosition +(onWeatherWatchSuccess, onWeatherError, { enableHighAccuracy: true }); +} + +// Success callback for watching your changing position + +var onWeatherWatchSuccess = function (position) { + +var updatedLatitude = position.coords.latitude; +var updatedLongitude = position.coords.longitude; + +if (updatedLatitude != Latitude && updatedLongitude != Longitude) { + +Latitude = updatedLatitude; +Longitude = updatedLongitude; + +// Calls function we defined earlier. +getWeather(updatedLatitude, updatedLongitude); +} +} + +``` + +## See where you are on a map + +Both Bing and Google have map services. We'll use Google's. You'll need a key but it's free if you're just trying things out. + +Add a reference to the **maps** service. + +```HTML + + https://maps.googleapis.com/maps
[GitHub] cordova-plugin-geolocation pull request: New PR for sample content...
Github user normesta commented on a diff in the pull request: https://github.com/apache/cordova-plugin-geolocation/pull/75#discussion_r59793647 --- Diff: README.md --- @@ -296,3 +311,436 @@ callback function when an error occurs with navigator.geolocation. - Returned when the device is unable to retrieve a position. In general, this means the device is not connected to a network or can't get a satellite fix. - `PositionError.TIMEOUT` - Returned when the device is unable to retrieve a position within the time specified by the `timeout` included in `geolocationOptions`. When used with `navigator.geolocation.watchPosition`, this error could be repeatedly passed to the `geolocationError` callback every `timeout` milliseconds. + + +## Sample: Get the weather, find stores, and see photos of things nearby with Geolocation ## + +Use this plugin to help users find things near them such as Groupon deals, houses for sale, movies playing, sports and entertainment events and more. + +Here's a "cookbook" of ideas to get you started. In the snippets below, we'll show you some basic ways to add these features to your app. + +* Get your coordinates. --- End diff -- That's what I was thinking as well. Unfortunately the tags used to create anchor links are ugly and only benefit the HTML view of this file. Folks who read the readme right out of their project will get the text representation of the anchor link - which is like etc. I opted for not littering the top with links as that does not seem to be the protocol being used for other sections of the readme. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-plugin-geolocation pull request: New PR for sample content...
Github user normesta commented on a diff in the pull request: https://github.com/apache/cordova-plugin-geolocation/pull/75#discussion_r59793230 --- Diff: README.md --- @@ -296,3 +311,436 @@ callback function when an error occurs with navigator.geolocation. - Returned when the device is unable to retrieve a position. In general, this means the device is not connected to a network or can't get a satellite fix. - `PositionError.TIMEOUT` - Returned when the device is unable to retrieve a position within the time specified by the `timeout` included in `geolocationOptions`. When used with `navigator.geolocation.watchPosition`, this error could be repeatedly passed to the `geolocationError` callback every `timeout` milliseconds. + + +## Sample: Get the weather, find stores, and see photos of things nearby with Geolocation ## + +Use this plugin to help users find things near them such as Groupon deals, houses for sale, movies playing, sports and entertainment events and more. + +Here's a "cookbook" of ideas to get you started. In the snippets below, we'll show you some basic ways to add these features to your app. + +* Get your coordinates. +* Get the weather forecast. +* Receive updated weather forecasts as you drive around. +* See where you are on a map. +* Find stores near you. +* See pictures of things around you. + +## Get your geolocation coordinates + +```javascript + +function getWeatherLocation() { + +navigator.geolocation.getCurrentPosition +(onWeatherSuccess, onWeatherError, { enableHighAccuracy: true }); +} + +``` +## Get the weather forecast + +```javascript + +// Success callback for get geo coordinates + +var onWeatherSuccess = function (position) { + +// We declared Latitude and Longitude as global variables +Latitude = position.coords.latitude; +Longitude = position.coords.longitude; + +getWeather(Latitude, Longitude); +} + +// Get weather by using coordinates + +function getWeather(latitude, longitude) { + +var queryString = + "http://gws2.maps.yahoo.com/findlocation?pf=1&locale=en_US&offset=15&flags=&q="; ++ latitude + "%2c" + longitude + "&gflags=R&start=0&format=json"; + +$.getJSON(queryString, function (results) { + +if (results.Found > 0) { +var zipCode = results.Result.uzip; +var queryString = "https://query.yahooapis.com/v1/public/yql?q="; + + "select+*+from+weather.forecast+where+location=" + + zipCode + "&format=json"; + +$.getJSON(queryString, function (results) { + +if (results.query.count > 0) { +var weather = results.query.results.channel; + +$('#description').text(weather.description); +$('#temp').text(weather.wind.chill); +$('#wind').text(weather.wind.speed); +$('#humidity').text(weather.atmosphere.humidity); +$('#visibility').text(weather.atmosphere.visibility); +$('#sunrise').text(weather.astronomy.sunrise); +$('#sunset').text(weather.astronomy.sunset); +} +}); +} +}).fail(function () { +console.log("error getting location"); +}); +} + +// Error callback + +function onWeatherError(error) { +console.log('code: ' + error.code + '\n' + +'message: ' + error.message + '\n'); +} + +``` + +## Receive updated weather forecasts as you drive around + +```javascript + +// Watch your changing position + +function watchWeatherPosition() { + +return navigator.geolocation.watchPosition +(onWeatherWatchSuccess, onWeatherError, { enableHighAccuracy: true }); +} + +// Success callback for watching your changing position + +var onWeatherWatchSuccess = function (position) { + +var updatedLatitude = position.coords.latitude; +var updatedLongitude = position.coords.longitude; + +if (updatedLatitude != Latitude && updatedLongitude != Longitude) { + +Latitude = updatedLatitude; +Longitude = updatedLongitude; + +// Calls function we defined earlier. +getWeather(updatedLatitude, updatedLongitude); +} +} + +``` + +## See where you are on a map + +Both Bing and Google have map services. We'll use Google's. You'll need a key but it's free if you're just trying things out. + +Add a reference to the **maps** service. + +```HTML + + https://maps.googleapis.com/maps
[GitHub] cordova-plugin-geolocation pull request: New PR for sample content...
Github user rakatyal commented on a diff in the pull request: https://github.com/apache/cordova-plugin-geolocation/pull/75#discussion_r58266872 --- Diff: README.md --- @@ -296,3 +311,436 @@ callback function when an error occurs with navigator.geolocation. - Returned when the device is unable to retrieve a position. In general, this means the device is not connected to a network or can't get a satellite fix. - `PositionError.TIMEOUT` - Returned when the device is unable to retrieve a position within the time specified by the `timeout` included in `geolocationOptions`. When used with `navigator.geolocation.watchPosition`, this error could be repeatedly passed to the `geolocationError` callback every `timeout` milliseconds. + + +## Sample: Get the weather, find stores, and see photos of things nearby with Geolocation ## + +Use this plugin to help users find things near them such as Groupon deals, houses for sale, movies playing, sports and entertainment events and more. + +Here's a "cookbook" of ideas to get you started. In the snippets below, we'll show you some basic ways to add these features to your app. + +* Get your coordinates. --- End diff -- We could actually live away with the index of entire README. Just adding links to this should be good enough. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-plugin-geolocation pull request: New PR for sample content...
Github user rakatyal commented on the pull request: https://github.com/apache/cordova-plugin-geolocation/pull/75#issuecomment-204563680 Also I know this is not completely on you, but would you mind adding a list (index) at the starting of the README with links to the major headings? That would help in navigating through the examples and other content. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-plugin-geolocation pull request: New PR for sample content...
Github user rakatyal commented on a diff in the pull request: https://github.com/apache/cordova-plugin-geolocation/pull/75#discussion_r58266173 --- Diff: README.md --- @@ -296,3 +311,436 @@ callback function when an error occurs with navigator.geolocation. - Returned when the device is unable to retrieve a position. In general, this means the device is not connected to a network or can't get a satellite fix. - `PositionError.TIMEOUT` - Returned when the device is unable to retrieve a position within the time specified by the `timeout` included in `geolocationOptions`. When used with `navigator.geolocation.watchPosition`, this error could be repeatedly passed to the `geolocationError` callback every `timeout` milliseconds. + + +## Sample: Get the weather, find stores, and see photos of things nearby with Geolocation ## + +Use this plugin to help users find things near them such as Groupon deals, houses for sale, movies playing, sports and entertainment events and more. + +Here's a "cookbook" of ideas to get you started. In the snippets below, we'll show you some basic ways to add these features to your app. + +* Get your coordinates. +* Get the weather forecast. +* Receive updated weather forecasts as you drive around. +* See where you are on a map. +* Find stores near you. +* See pictures of things around you. + +## Get your geolocation coordinates + +```javascript + +function getWeatherLocation() { + +navigator.geolocation.getCurrentPosition +(onWeatherSuccess, onWeatherError, { enableHighAccuracy: true }); +} + +``` +## Get the weather forecast + +```javascript + +// Success callback for get geo coordinates + +var onWeatherSuccess = function (position) { + +// We declared Latitude and Longitude as global variables +Latitude = position.coords.latitude; +Longitude = position.coords.longitude; + +getWeather(Latitude, Longitude); +} + +// Get weather by using coordinates + +function getWeather(latitude, longitude) { + +var queryString = + "http://gws2.maps.yahoo.com/findlocation?pf=1&locale=en_US&offset=15&flags=&q="; ++ latitude + "%2c" + longitude + "&gflags=R&start=0&format=json"; + +$.getJSON(queryString, function (results) { + +if (results.Found > 0) { +var zipCode = results.Result.uzip; +var queryString = "https://query.yahooapis.com/v1/public/yql?q="; + + "select+*+from+weather.forecast+where+location=" + + zipCode + "&format=json"; + +$.getJSON(queryString, function (results) { + +if (results.query.count > 0) { +var weather = results.query.results.channel; + +$('#description').text(weather.description); +$('#temp').text(weather.wind.chill); +$('#wind').text(weather.wind.speed); +$('#humidity').text(weather.atmosphere.humidity); +$('#visibility').text(weather.atmosphere.visibility); +$('#sunrise').text(weather.astronomy.sunrise); +$('#sunset').text(weather.astronomy.sunset); +} +}); +} +}).fail(function () { +console.log("error getting location"); +}); +} + +// Error callback + +function onWeatherError(error) { +console.log('code: ' + error.code + '\n' + +'message: ' + error.message + '\n'); +} + +``` + +## Receive updated weather forecasts as you drive around + +```javascript + +// Watch your changing position + +function watchWeatherPosition() { + +return navigator.geolocation.watchPosition +(onWeatherWatchSuccess, onWeatherError, { enableHighAccuracy: true }); +} + +// Success callback for watching your changing position + +var onWeatherWatchSuccess = function (position) { + +var updatedLatitude = position.coords.latitude; +var updatedLongitude = position.coords.longitude; + +if (updatedLatitude != Latitude && updatedLongitude != Longitude) { + +Latitude = updatedLatitude; +Longitude = updatedLongitude; + +// Calls function we defined earlier. +getWeather(updatedLatitude, updatedLongitude); +} +} + +``` + +## See where you are on a map + +Both Bing and Google have map services. We'll use Google's. You'll need a key but it's free if you're just trying things out. + +Add a reference to the **maps** service. + +```HTML + + https://maps.googleapis.com/maps
[GitHub] cordova-plugin-geolocation pull request: New PR for sample content...
Github user riknoll commented on the pull request: https://github.com/apache/cordova-plugin-geolocation/pull/75#issuecomment-204179610 I've gone ahead and created a JIRA to track this effort ([CB-11003](https://issues.apache.org/jira/browse/CB-11003)) --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org
[GitHub] cordova-plugin-geolocation pull request: New PR for sample content...
GitHub user normesta opened a pull request: https://github.com/apache/cordova-plugin-geolocation/pull/75 New PR for sample content - sample link removed You can merge this pull request into a Git repository by running: $ git pull https://github.com/normesta/cordova-plugin-geolocation master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-plugin-geolocation/pull/75.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #75 commit ed59863125a4692a1800cf12d9552a5fb14d5e3b Author: Norm Estabrook Date: 2016-03-25T20:12:29Z updating readme witha sample and snippets commit ba68accdb164606a4982ac569f8004f939e6e561 Author: Norm Estabrook Date: 2016-03-31T23:44:47Z Removing sample link and including sample content --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org