Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Google maps and Perl

by Anonymous Monk
on Sep 26, 2009 at 00:04 UTC ( #797624=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, I'm looking for any information on using perl with google maps. I'm trying to find any code that will let a person move a marker and then save that new position back to a perl variable for further use. I can find a fair amount of php stuff, but very little perl. Surely there is some somewhere? Can some kind Monk point my in the right direction?

Replies are listed 'Best First'.
Re: Google maps and Perl
by jrtayloriv (Pilgrim) on Sep 26, 2009 at 06:52 UTC

    Look up GMarkerManager or Google Maps MarkerManager. I'm pretty sure that's what you want. If it's not what you wanted, could you please describe what you're trying to do, so we can understand the context?

    --Jesse Taylor

Re: Google maps and Perl
by SilasTheMonk (Chaplain) on Sep 26, 2009 at 21:08 UTC

    I think what you need to do is to override the dragend event of the GMarker class (http://code.google.com/apis/maps/documentation/reference.html#GMarker.dragend) to capture your move of the marker. Your function would need to make an AJAX style call to update the server of the move of the marker. So I would say about 50% of the problem is in javascript, about 20% in your markup and only about 30% in server side code (which could be perl). As such it is quite hard to encapsulate in perl. It can be done (and I was thinking of doing so for a much simpler problem) but you would have to supply a lot of javascript and HTML documentation to go along with it. You probably want to start by just making the dragend functon call "alert" before you start worring about AJAX and updating the server.

    Edit: Thinking about it, something I wrote could be extended to provide support for this. It would work with HTML::Template::Plugin::Dot (and possibly other template frameworks). As I said above, only about 30% of it would actually be perl. The other would be docs and explanation. I am a bit busy now at the moment so I would like to ask what is your timeframe? What I could do is send a private email with an explanation of what I have done and how I would adapt it to meet your needs.

    Edit 2: Also another question. You talk about "saving back to a perl variable". That does not make sense. You need to be saving back to some sort of persistent storage, though of course you might like to hide that behind a variable.

    Edit 3:New development: RFC: Geo::Google::MapObject.

Re: Google maps and Perl
by Anonymous Monk on Sep 26, 2009 at 00:39 UTC
    Did you check CPAN?
      Yes, Geo::Google::StaticMaps WebService::GoogleMaps Geo::Coder::GoogleMaps but none of them seem to handle taking data back in, only on outputing to GM. I may be missing something, but if someone could point me to the correct module, or some demo code on reading data back into perl from maps, that would be fantastic.
        I'm not an expert on google offerings, but I'm sure first you need to find what you're looking for on google, like http://code.google.com/apis/maps/faq.html, then you go looking for how to interface to it using perl.
        please give the example code because i am new in this field i don't know how to use these modules.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://797624]
Approved by broomduster
help
Chatterbox?
[haukex]: But that module I just linked to assumes that most verbatim blocks are runnable code, I have other modules where that's not the case, so there I just copy-and-paste the synopsis into the author tests...
[haukex]: not the most efficient, but then again, I don't have that many modules on CPAN :-)
[Corion]: haukex: Yes, but if it's only supposed to run on my machine, I can be far more liberal with how I extract the code etc.
[Corion]: haukex: Yes - I see the benefit of using Dist::Zilla for people with 150+ modules on CPAN, but I don't see it for myself, and I'm always put off from contributing to such modules because they require a lot of toolchain setup that I don't want to ...
[Corion]: ... spend time on if I only want to provide a short patch
[haukex]: Corion: Yes exactly, in the author tests I don't worry about portability as much, I also don't list the author tests' dependencies in Makefile.PL
[haukex]: I figure someone who wants to contribute will know how to install the missing modules ;-) Not the nicest way to go but I don't think many people are using my modules yet

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (11)
As of 2017-02-27 12:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (385 votes). Check out past polls.