geocoder-php / geocoder Goto Github PK
View Code? Open in Web Editor NEWThe most featured Geocoder library written in PHP.
Home Page: https://geocoder-php.org
License: MIT License
The most featured Geocoder library written in PHP.
Home Page: https://geocoder-php.org
License: MIT License
Hi,
I'm one of the maintainers for the geocoder module for Drupal (an open-source content-management system). You can see the module page here: http://drupal.org/project/geocoder
We'd like to make extensive of your awesome Geocoder library in our project. Ideally we would like to distribute it packaged with our module, but given that Drupal is licensed under the GPLv2 and Geocoder library is licensed as MIT that is not currently possible. Would you be willing to dual-license your project as both GPLv2 and MIT? This would allow us to legally distribute it with our module.
FYI, jQuery is also dual-licensed MIT and GPLv2 (http://jquery.org/license/) so that it can be legally shipped with GPL projects.
Thank you for your consideration,
~Patrick Hayes
Why not loop through all providers until one returns a result if using()
hasn't been called before? In addition, allow using()
to be called with a null
argument to reset previous selection.
I'm not really fan of my implementation of providers
, especially since reverse geocoding has been added.
Hello,
il y a un problème d'encodage.
j'ai utilisé ce code :
https://gist.github.com/beed39d347f1b0fcfb51
et voila le résultat :
https://gist.github.com/53cd3126ba519be702d5
Cordialement,
Axel
Hello,
I'm trying to retrieve locations using latitude and longitude, but am currently receiving null.
I thought it might be to-do with some wrong lat & long coordinates, but I'm using the coordinates in the example of http://geocoder-php.org/ (top of the page), and am still receiving null.
So I've tried this
$result = $geocoder->reverse(44.9817,-93.2783);
//
and this
$result = $geocoder->geocode(44.9817,-93.2783);
I've also tried wrapping the coordinates in speech marks/apostrophes, to apply coordinates as strings.
I can however retrieve the location with an IP, using the example;
$result = $geocoder->geocode('68.145.37.34');
Hello,
First I'm glad to see this project!
But I think I makes sense to seperate the two options "Geocode by Ip" and "Geocode by Address".
ATM there is only $geocoder->geocode($value)
The ->geocode()
method should return an object, which implements the ArrayAccessInterface
and has two methods : fromArray()
, toArray()
.
We can name this object Result\Geocoded
and we can do the same for the reverse()
method (Result\Reversed
).
There is nothing to invent as we just have to move the code in the `Geocoder class.
cc @themouette
William
/cc @jsor
The Google Maps API allows sending the Region Biasing. It allows sending a region where the request is send from. I could not find a way to set this option.
https://developers.google.com/maps/documentation/geocoding/#RegionCodes
If $searchResult is not set on Line 53, the whole foreach does not work and on line 63 it will throw a fatal error:
Fatal error: Call to a member function getAttribute() on a non-object in /***/vendor/Geocoder/src/Geocoder/Provider/OpenStreetMapsProvider.php on line 63
It some use cases, a locale database would be usefull.
e.g.:
Your project use the YahooPlaceFinder provider. You'r requests are limited from Yahoo!.
If your limit is reached, it will throw some error's - that's bad.
Solution:
You create a Fallback provider that wrap the YahooPlaceFinder provider and the Locale provider.
I got a syntax error in file install_vendors.sh
markus@development:/var/www/geocoder/Geocoder$ sh ./bin/install_vendors.sh
: not foundll_vendors.sh: 2:
./bin/install_vendors.sh: 3: function: not found
: not foundll_vendors.sh: 4: {
Installing/Updating
: not foundll_vendors.sh: 6:
./bin/install_vendors.sh: 30: Syntax error: end of file unexpected (expecting "then")
E.g:
Hello!
Actually i'm trying to setup up the geocoder lib to work within our ZF application. Therefore i want to use the ZF autoloader function. But without the ZF compatible namespaces or class naming autloading of the classes, i'm not sure to do this.
Can you explain me how to autload the geocoder library in a ZF application. I added the src-folder locally to the folder:
"D:\Program Files (x86)\Zend\ZendServer\share\ZendFramework\library"
best regards
if you try getting address where the house number contains a letter, such as http://maps.googleapis.com/maps/api/geocode/json?address=Oeserstr.+1a%2C+65934+Frankfurt+am+Main%2C+Deutschland&sensor=false
we get from google right data:
{
"long_name" : "1A",
"short_name" : "1A",
"types" : [ "street_number" ]
}
but because of $this->streetNumber = (int) $data['streetNumber'];
we get only "1" by the getStreetNumber method
Not all unit tests pass.
To calculate the distance between 2 points.
It should be possible to specify a locale for both, normal and reverse lookups.
Hi there,
is there any special reason, why both properties are private?
https://github.com/willdurand/Geocoder/blob/master/src/Geocoder/Provider/AbstractProvider.php#L28
I'm on the task to have a result being displayed in the users locale, it would be great to have a setLocale
method to alter the locale for different iterations when retrieving geocoding results.
Perhaps beyond the scope of the project, but I think it would be useful to make for a fully featured geocoder, pretty much all other aspects are already covered.
I quite like the implementation in https://github.com/dsyph3r/GoogleGeolocationBundle, something similar with an additional field in the log for whichever provider was used, and uniqueness of search based off the values inputted and provider used:
CREATE TABLE `geolocation_location` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`search` varchar(255) NOT NULL,
`provider` varchar(255) NOT NULL,
`matches` smallint(6) NOT NULL,
`status` varchar(20) NOT NULL,
`result` longtext NOT NULL,
`hits` int(11) NOT NULL,
`created` datetime NOT NULL,
`updated` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=latin1;
NB: He has also implemented a generic API log, which may also be useful:
CREATE TABLE `geolocation_api_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`lastStatus` varchar(20) NOT NULL,
`requests` int(11) NOT NULL,
`created` date NOT NULL,
`updated` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UNIQ_26CE10BDB23DB7B8` (`created`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
See OIORestProvider for more details.
There is currently no posibillity to handle sublocality. Unfortunately there is no method.
It is not possible to get data from:
{
"long_name" : "Kalbach/Riedberg",
"short_name" : "Kalbach/Riedberg",
"types" : [ "sublocality", "political" ]
}
It may be useful to add new adapters like a CurlHttpAdapter
or a FopenAdapter
even if Buzz provides this kind of abstraction.
Assuming you have coordinates, you may want to get information from them (street address actually).
It can be easily doable by changing the ProviderInterface
:
getData()
method;reverse()
method.reverse()
method in the GeocoderInterface
.I think the current solution for autoload classes is very obscure.
We should use composer for autoloading. Composer can create automaticly a classmap.
For BC reasons i would create a closure to load the classes, if no composer is available. (Maybe with a warning)?
Hello,
I'm using Geocoder (http://geocoder-php.org/) in my application.
I've installed it using the steps provided on the website.
Problem:
When I run the application, I receive the error;
Fatal error: Class 'Buzz\Browser' not found in D:\xampp\htdocs\dmp\geocoder\src\Geocoder\HttpAdapter\BuzzHttpAdapter.php on line 31
Line 31:
-- code --
$this->browser = new Browser();
-- /code --
I have this in my autoload.php file;
-- code --
I think is more comfortable to use an CacheProvider.
gecoding of "Hannover" (city in Germany) causes notice error:
Notice: Undefined property: stdClass::$postalCode
Notice: Undefined property: stdClass::$adminDistrict2
Need to check with property_exists
Add a DumperInterface and additional dumpers, i.e.:
There is a way to pass a key to the google maps web services so it can do request over the normal quota.
https://developers.google.com/maps/documentation/business/webservices
Would you accept a pull request for this?
I would need to change the constructor API, but I can put the key after locale and optional, so old code keep working.
It could be nice to provide a getRawData()
method somewhere so that people can use raw data to get extra information.
It should probably be located in the providers as they already contain raw data.
Geocode notice when geocoding "Hamm"
Notice: Trying to get property of non-object [...] Geocoder/Provider/OpenStreetMapsProvider.php line 77
When using the composer.json settings to install the bundle, it don't install the Package into the right place.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.