views:

506

answers:

6

I'm specifically looking for one that lets me display a map of US states with each one as it's own "object" in the sense that I can control the color, on click, and on mouseover of each one individually. GTK is my personal preference, but at this point I'd settle for just about anything. The application itself will be written in Python, FWIW.

+2  A: 

You can use QGraphicsView in PyQt. Each state is a new QGraphicsItem, which is either a bitmap or a path object. You just need to provide the outlines (or bitmaps) and the positions of the states.

If you have SVGs of the states, you can use them, too.

There is no generally accepted canvas class for GTK+.

Torsten Marek
A: 

Yes, you can use cairo, but cairo is not a canvas. You have to code behavior like mouseover/onclick yourself.

Torsten Marek
A: 

Quick tip, if you color each state differently you can identify which one to pick from the color under mouse cursor rather than doing a complex point in polygon routine.

Martin Beckett
A: 

If you consider Qt, consider also throwing in kdelibs dependency, then you'll have marble widget, which handles maps in neat way.

If you stick only to Qt, then QGraphicsView is a framework to go.

(note: kdelibs != running whole kde desktop)

A: 

You can use Quantum GIS. QGIS is a Open Source Geographic Information System using the Qt Framework.

QGIS can also be used with Python. You can either extend it with plugins written in Python or use the PyGIS Python bindings to write your own application.

They have a Wiki with some good informations for developers.

Maybe QGIS is to heavy for your purpose, but I add it here for completition anyway.

jk
A: 

If you consider Qt, consider also throwing in kdelibs dependency, then you'll have marble widget, which handles maps in neat way.

Thanks for advertizing Marble. But you are incorrect:

The Marble Widget doesn't depend on kdelibs at all. It just depends on Qt (>=4.3).

Additionally Marble also has just received Python bindings.

I think that the given problem can be solved using Marble. Would just take a few days of work at max. If you have questions about Marble, feel free to ask us on our mailing list or IRC.

Best Regards, Torsten Rahn