Giter Site home page Giter Site logo

jeoquery's Introduction

jeoquery

jQuery wrapper for easily calling geonames.org jsonp services, and a few ui-controls for populating html selects and inputs with geonames data.

Why use it?

There are heaps of server side libs that wrap geonames services. Many web-projects use these libs and make their web pages do a request against their own server which in turn does another request against the geonames services. This is really not necessary, use the geonames service directly from the users browser, and avoid superflous latency!

How to use

You need to:

  • Download and include jeoquery.js
  • Get an account at geonames: http://www.geonames.org/login (it's free)
  • Set this account before using any methods: jeoquery.defaultData.userName = 'your-geonames-user';

Check out the demo-pages for more info: http://tompi.github.com/jeoquery/

Maintainer

Thomas Haukland [email protected]

License

The same as jquery: http://jquery.org/license

jeoquery's People

Contributors

tompi 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jeoquery's Issues

Methods?

How can I use the timezone method? can't find any use case anywhere..

Cannot read property 'sort' of undefined

Hi,

I'm getting Cannot read property 'sort' of undefined error on this part
if (data.geonames.sort) { sortedNames = data.geonames.sort(function (a, b) { return a.countryName.localeCompare(b.countryName); }); }

Hoping for your fast response.

Thanks!

Multiple country codes

Hello. How can i use multiple contry code in 'search' request?
i.e. "country=US&country=RU"

jQuery.noConflict() compatibility

Please consider revising to be compatible with jQuery.noConflict(). I'd like to use this on an app that began as a prototype.js project that then needed some jQuery, so I ended up using both libraries, but the present $ shortcut is reserved for prototype and this code breaks. Demo looks great, looking forward to using it.

Use traditional: true in ajax query

Actualy, duplicate paramters are send as param[]=A&param[]=B.. But geoname waiting format is param=1&param=B...

To achieve this, you must use the parameter "traditional: true" on the ajax query;

I encounteer this probleme with featureClass param.

Wrong continent

Hi,

when using Novosibirsk to search for the city's country, state and continent I get Novosibirsk/ Novosibirsk Oblast / Russia / EU

While Russia is part in Europe, part in Asia shouldn't the continent be based on the city/address/a config setting, not only the country.
Also Russia is ~70% in Asia so more or less I would consider it an Asian country.

Maybe something can be done to retrieve the continent for address/city/country.

For example an address in Istanbul can be in Europe and another in Asia as Istanbul is on 2 continents.
Thank you

Just not working for me

This is my file and I've added the username and it just doesnt want to work for me! What is wrong with this file?

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Insert title here</title>
        <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
    </head>
    <body class="container">
        <div class="row">
            <p>
                Go on, select a country first... Try viewing the source, the select is
                populated on load by a geonames call.
            </p>
        </div>
        <div class="row well forms-horizontal" id="countrySelect">
            <label for="country">Country: <select id="country" disabled="disabled"></select> </label>
        </div>
        <div class="row">
            <p>
                Next, try to input a postal code for this country, and the place should
                be populated by a geonames service as you leave the input(tab or mouse
                click elsewhere).
            </p>
        </div>
        <div class="row well forms-horizontal" id="postal">
            <label for="postalCode">Postal code:
                <input class="input-small" id="postalCode" type="text" />
            </label>
            <label for="postalPlace">Postal place:
                <input id="postalPlace" type="text"/>
            </label>
        </div>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        <script src="js/jeoquery.js"></script>
        <script>
            $(function() {
                jeoquery.defaultData.userName = 'myusername';

                $("#country").jeoCountrySelect({
                    callback : function() {
                        $("#country").removeAttr('disabled');
                    }
                });
                $("#postalCode").jeoPostalCodeLookup({
                    countryInput : $("#country"),
                    target : $("#postalPlace")
                });

            });
        </script>
    </body>
</html>

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.