# Map-like thing with custom location marking

**URL:** <https://www.ruby-forum.com/t/map-like-thing-with-custom-location-marking/158865>\
**Category:** Ruby-Gnome 2\
**Created:** [January 28, 2009, 10:11pm UTC](https://www.ruby-forum.com/t/map-like-thing-with-custom-location-marking/158865 "2009-01-28T22:11:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![syn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3ab097/32.png) [@syn](https://www.ruby-forum.com/u/syn)\
**Post date:** [January 28, 2009, 10:11pm UTC](https://www.ruby-forum.com/t/map-like-thing-with-custom-location-marking/158865/1 "2009-01-28T22:11:28Z")

</div>

before I say anything else, I’d like to take this oppertunity to say hi  
to everyone (at least all who’ll read this) since I’m new here.

now on to business!  
here’s the thing:  
I’m quite new to ruby and newer still to gtk (not a promising combo, but  
hey… we all have to start somewhere, right? … right??) so my  
knowledge of the gtk api isn’t all that good.

what I’m trying to do is basically this:  
I’d like to make an application that would (among other things) take an  
image file (let’s say the image is some sort of a map) and display it,  
and allow the user to add markings to it (kind of like wikimapia does,  
for instance)  
so basically you click on the image, and a dialog prompts you for  
certain information that you wish to associate with that locations, and  
once that’s done, that location gets that little rectangle thingy that  
signifies that it’s marked. and somewhere on the side there’s a list of  
all those markings.

now the problem is that, like I said, I’m not that familiar with gtk api  
so I don’t know how to do that and which widgets and objects to use.  
(for that map and mark thing)  
any kind of help and/or suggestion would be greatly appriciated

---

<div class="post-metadata">

**Author:** ![syn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3ab097/32.png) [@syn](https://www.ruby-forum.com/u/syn)\
**Post date:** [January 29, 2009, 9:02am UTC](https://www.ruby-forum.com/t/map-like-thing-with-custom-location-marking/158865/2 "2009-01-29T09:02:42Z")

</div>

Welcome!

> now the problem is that, like I said, I’m not that familiar with gtk api  
> so I don’t know how to do that and which widgets and objects to use.  
> (for that map and mark thing)  
> any kind of help and/or suggestion would be greatly appriciated

There are two answers:

- tell you what widgets and objects to use. Quite fast for you but not  
necessarily for me, and doesn’t teach you much about gtk overall big  
picture, way of doing things, etc.

- suggest you to read a gtk tutorial. Quite fast for me but not for  
you, but will teach you a lot on gtk, so pretty good in the mid/long  
term.

I’ve chosen the second solution 🙂

[http://library.gnome.org/devel/gtk-tutorial/stable/](http://library.gnome.org/devel/gtk-tutorial/stable/)

Enjoy the reading 🙂

–  
Guillaume C. - [Guillaume Cottenceau](http://zarb.org/~gc/)

---

<div class="post-metadata">

**Author:** ![syn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3ab097/32.png) [@syn](https://www.ruby-forum.com/u/syn)\
**Post date:** [January 29, 2009, 9:44am UTC](https://www.ruby-forum.com/t/map-like-thing-with-custom-location-marking/158865/3 "2009-01-29T09:44:20Z")

</div>

attached is something to start from,  
a guide for the reading.

---

<div class="post-metadata">

**Author:** ![syn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3ab097/32.png) [@syn](https://www.ruby-forum.com/u/syn)\
**Post date:** [January 29, 2009, 10:18am UTC](https://www.ruby-forum.com/t/map-like-thing-with-custom-location-marking/158865/4 "2009-01-29T10:18:55Z")

</div>

For something like this, you’d be better off looking at the goocanvas  
API and examples. I’ve done something similar in the past, and  
goocanvas is going to take care of a lot of the gruntwork for you vs.  
doing it by hand as you have below.

Check out the API (unfortunately not published on the Hiki as it’s  
experimental at the momoment), but it’s similar in spirit to the  
GnomeCanvas library (which is there). If you pull the full source  
package, you can see the examples which will help get you going (but you  
might have to build it yourself–not sure as I haven’t worked with it  
since it’s been included in the full distribution.

HTH,

ast

On Thu, 2009-01-29 at 10:43 +0200, Dobai-Pataky BÃ¡lint wrote:

> > hey… we all have to start somewhere, right? … right??) so my  
> > signifies that it’s marked. and somewhere on the side there’s a list of  
> > w.signal\_connect(“destroy”){Gtk.main\_quit}  
> > pc=c
> 
> * * *
> 
> This [SF.net](http://SF.net) email is sponsored by:  
> SourcForge Community  
> SourceForge wants to tell your story.  
> [Best Open Source Mac Front-Ends 2023](http://p.sf.net/sfu/sf-spreadtheword)  
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ ruby-gnome2-devel-en mailing list removed\_email\_address@domain.invalid [ruby-gnome2-devel-en List Signup and Options](https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en)  
> –  
> Andrew S. Townley [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [http://atownley.org](http://atownley.org)

---

<div class="post-metadata">

**Author:** ![syn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3ab097/32.png) [@syn](https://www.ruby-forum.com/u/syn)\
**Post date:** [January 29, 2009, 4:58pm UTC](https://www.ruby-forum.com/t/map-like-thing-with-custom-location-marking/158865/5 "2009-01-29T16:58:24Z")

</div>

thanks a lot for your replies everyone

that goocanvas just hit the spot. I checked it out and tried it out a  
bit and it seems like it just might be perfect for what I need.

as for that tutorial, I will check it out (eventually :P)  
the thing is that I did work with gtk before a little,  
so I’m not completely clueless about it, as I might have made myself  
look.  
it would seem that I declued myself a bit too much haha  
(oh look, I just made up a new word… silly me)

anyways,  
once again, thank you all, your help is much appreciated!

I will be sure to ask something when I get stuck again!
