Giter Club home page Giter Club logo

geo-location's Introduction

Published on webcomponents.org

<geo-location>

Geolocation API Polymer web component.

Example to get the device geolocation values:

<geo-location latitude="{{latitude}}" longitude="{{longitude}}"></geo-location>

<ul>
  <li>Latitude: [[latitude]]</li>
  <li>Longitude: [[longitude]]</li>
</ul>

geo-location's People

Contributors

atotic avatar diegohaz avatar ebidel avatar fluorescenthallucinogen avatar jeffposnick avatar kaste avatar kolarski avatar motss avatar rbellens avatar rubenstolk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geo-location's Issues

<geo-location> initial request is always with low accuracy, not cached and with wrong timeout. All attributes are ignored.

When having attributes like so:

<geo-location maximum-age="30000" high-accuracy="true" ></geo-location>

like maximum-age or high-accuracy every initial request ignores those attributes;

The Guard placed in fetch method is not sufficient to ensure the element is ready:

fetch: function () {
        // Guard clause in case observer runs before element is ready. Refer to Polymer issue #3438
        // https://github.com/Polymer/polymer/issues/3438
        if (this.idle === undefined || this.watchPos === undefined) {
          return;
        }

The fetch method (observer) is called twice - for each default value of this.idle and this.watchPos

idle: {
    type: Boolean,
    value: false,
    observer: 'fetch'
},
watchPos: {
    type: Boolean,
    value: false,
    observer: 'fetch'
}

but when this.idle and this.watchPos are set - the element is still not ready and none of the attributes are available , and fetch is executed with options like:

Object {enableHighAccuracy: undefined, timeout: undefined, maximumAge: undefined}

This causes maximum-age to not cache the location the first time, the first location is not accurate since the high-accuracy is not true and all sorts of problems on mobile device as well as performance issues.

A simple fix that is working for me is to add the 3 attributes to the list like so:

if (this.idle === undefined || this.watchPos === undefined || this.highAccuracy === undefined || this.timeout === undefined || this.maximumAge === undefined) {
          return;
        }

Repo description

It makes sense to remove the https://ebidel.github.io/geo-location/ demo (gh-pages branch) completely, because:

  1. it's outdated
  2. the https://webcomponents.org catalog obsoletes the creation of GitHub pages for Polymer documentation and demos (see https://medium.com/collaborne-engineering/polymer-simplify-travis-builds-with-webcomponents-org-f44c3a879f3c)

Fallback for Timeouts?

Since your code has a five-second timeout, it is likely that devices will timeout before resolving location, especially with the accuracy turned up. Have you considered adding a backstop JSON service to perform IP-based geolocation if the initial resolution fails?

Current GPS accuracy

Is there a way to incorporate GPS accuracy estimate? I am pretty sure the data should be provided.

Android support

Hello, the component seems to be inactive on android devices. I tried with a Huawai tablet with android 7.0, and a Samsung Galaxy S8 with android 8.0.0.
The demo is not locating me, it renders a map that start at coordinate [0,0]

Stop working

It was workig a few days ago but now it only returns
2: Network location provider at 'https://www.googleapis.com/' : Returned error code 403.

Do I need an API_Key and set it somewere or it is realy bugged now?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.