semio has asked for the wisdom of the Perl Monks concerning the following question:

fellow Monks,

I currently have some crime information, ie. robbery, car theft, etc., for the area in which I live. For each type of crime there is a corresponding street address. I'm thinking the data will be much more meaningful (and visually appealing) if I represent it graphically. The goal is such that each type of crime will be plotted to a map and each type of crime will have a unique marker, such as a blue dot for a car theft, a red dot for a robbery, etc. I've started by looking at Geo-Coder, but I'm curious to know if other monks have tackled this problem before and, if so, how did you go about it? Any suggestions are greatly appreciated.

cheers!
-dave

Replies are listed 'Best First'.
Re: graphing data points
by wufnik (Friar) on Jul 08, 2004 at 21:21 UTC
    CAIDA,

    http://www.caida.org/home ie the Cooperative Association for Internet Data Analysis, have been active in this domain for a while; some of the most spectactular 2d visualizations i have seen come from the site above.

    one of their tools is geoplot:

    http://www.caida.org/tools/visualization/geoplot/Demo/GPDemo.html

    an *applet* <sigh> which *thankfully* has a perl API that allows you to add nodes , links, paths etc on the applet. very kewl. of course, different maps can be specified, but i dunno if this is at the perl API level.

    here is the link for the perl API:

    http://www.caida.org/tools/visualization/geoplot/API/

    best of luck, /msg me if you have success/probs -

    ...wufnik

    -- in the world of the mules there are no rules --
Re: graphing data points
by Mercio (Scribe) on Jul 08, 2004 at 19:11 UTC
    I believe the correct term would be to plot and not graph.

    That having been said, you might want to try a combination of Geo::Coder and Geo::GNUPLot. Use Geo::Coder to grab the longitude and latitude of the address and then use Geo::GNUPlot to plot the cordinates on a map. You could also use Image::Maps::Plot::FromLatLong. I'm not sure exactly how to use these modules, I've only used them once and decided I didn't realy need them.

    Hope this helps you out.
Re: graphing data points
by kryberg (Pilgrim) on Jul 12, 2004 at 15:01 UTC
    I have had success plotting data indicators on a map with associated labels and alt text information as well as html links to more information using drawmap - spot the monk! . The program use GD.pm.

    The code would need modification for a specific project.

    You would need a map of your area in geographic projection and you would need to know the lat and long that correspond to the north, south, east, and west edges of your map in order to change a few of the calculations in the program. Some of the calculations need to be changed because the program assumes the map being used is one of the entire world with the prime meridian in the center of the map.

    Assuming you are familiar with latitude and longitude, once you understand how the program works it's not hard to modify to a specific area of the world.

    Good luck.
Re: graphing data points
by neeraj (Scribe) on Jul 09, 2004 at 05:03 UTC
    Why don't you try GD::Graph , or if you have kept the data in some database use DBD::Chart , it gives really nice graphs and provides lots of flexibility to user.
      The question was how to add colored dots to a map at specific longitude/latitude coordinates. Graphing frequencies and the like isn't the issue.

      ------
      We are the carpenters and bricklayers of the Information Age.

      Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

      I shouldn't have to say this, but any code, unless otherwise stated, is untested