[Qgis-developer] Click-fu plugin

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Sat Nov 1 19:33:20 EDT 2008


I've just bashed out a new plugin, inspired by Maxim's google map
plugin and his use of QDesktopServices::openUrl. Mine of course is in
Python :)

Click-fu adds a new drop-down menu with a list of geo-based web
services. Currently there are three: Google maps, OpenStreetMap, and a
GeoNames XML search. The first two display a map on your web browser
when you click on a location after activating the tool, and the third
one brings up the Geonames extended search XML at the clicked
location. This lists country and subdivision and so on.

If anyone can think of any other web services that just take a single
lat-long pair then it's easy to add them, it takes about eight lines
of code (most of that is boilerplate). In fact so much is boilerplate
that it could be trivially easy to convert the plugin to just use a
config file with some kind of spec for each web service. Then the user
interface could include a config editor so you could add new web
services yourself.

Or I could add more configuration to the existing services - for
example at the moment the zoom scale of google maps and openstreetmap
is fixed.

Or I could add web service searches that rely on a bounding box -
geonames has a lot of these (www.geonames.org).

Code is on google code:

 svn checkout http://bsrplugins.googlecode.com/svn/trunk/clickfu clickfu

 No installer yet, just extract and put in your plugins folder.
Activate plugin from Manage Plugins, restart, click away.

 Notes:

  * It doesn't know if you've not got a lat-long coordinate system
going, so can request things for lat=122323,lon=373424. Your web
service might not like that.

  * Needs Qgis Preview 1.0 - I think its just because 0.11 has
getMainWindow and getMapCanvas whereas 1.0 has those without 'get'.

Have fun with it...

Barry


More information about the Qgis-developer mailing list