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

Oh wonderful perl gods, I have a problem and I do not know the best way to solve it. I need to write a program (doesn't have to be perl if you know a better suggestion) that will plot a tract of land. The end functionality needs to be that the user inputs lat/long coordinates, distance and heading/bearing (as generated by a surveyor) and the program will then generate a diagram showing the layout, shape, etc of the tract of land. The functionality seems relativley straightforward but I am a fairly new programmer and I can't seem to wrap my head around the best way to accomplish this. Do any of you know any modules, etc that may help? An example of a windows based program (I am writing for linux) that does this can be found at http://www.johnsonmapping.com/deed.html. The one I am creating only needs basic functionality and does not need to be nearly as complex as this one. Thanks in advance.

Replies are listed 'Best First'.
Re: Plotting a tract of land
by GrandFather (Saint) on Nov 03, 2006 at 07:52 UTC
Re: Plotting a tract of land
by Khen1950fx (Canon) on Nov 03, 2006 at 07:54 UTC
Re: Plotting a tract of land
by dewey (Pilgrim) on Nov 03, 2006 at 08:33 UTC
    I'd suggest using SVG ; this format is relatively easy and very appropriate for manipulating and displaying the type of diagrams appearing in the screenshots on the site you mentioned.
    ~dewey
Re: Plotting a tract of land
by planetscape (Chancellor) on Nov 03, 2006 at 21:36 UTC
Re: Plotting a tract of land
by zentara (Cardinal) on Nov 03, 2006 at 13:41 UTC
    The easiest way would be the Tk Canvas. See Tk compass dial for a simple demo. Once you create your Canvas plot, you can print it to postscript, like this:
    #!/usr/bin/perl use Tk; #to change the background color, edit the ps file # 0.000 0.000 0.000 setrgbcolor AdjustColor # fill $width = 800; $height = 500; my $main = MainWindow->new(); my $canvas = $main->Canvas( -width=>$width, -height=>$height, -backgro +und=>"black"); $canvas->pack( -expand=>1,-fill=>'both'); &create; $canvas->update; $main->update; $main->Button( -text => "Save", -command => [sub { $canvas->update; my @capture=(); my ($x0,$y0,$x1,$y1)=$canvas->bbox('all'); @capture=('-x'=>$x0,'-y'=>$y0,-height=>$y1-$y0,-width=>$x1-$x +0); $canvas -> postscript(-colormode=>'color', -file=>$0.'.ps', -rotate=>0, -width=>800, -height=>500, @capture); } ] )->pack; MainLoop; sub create{ $canvas->createOval(100, 100, 600, 600,-fill=>'green') }

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
Re: Plotting a tract of land
by j3 (Friar) on Nov 03, 2006 at 15:31 UTC

    Hi blhoward2, welcome to PerlMonks. :)

    One way you might start off very simply is to use a module like GD to do the drawing. That is, write a simple program that reads a plain text config file containing the relevant parameters, then uses GD to generate an image file.

    Then, later, when you're happy with that, you can consider at that point if you want to use something like Tk to add a GUI. Regarding GUI's btw, I remember reading a TPR article recently about using Glade and GTK+ to make GUI programs and it looked pretty nice.

Re: Plotting a tract of land
by fmerges (Chaplain) on Nov 03, 2006 at 16:24 UTC

    Hi,

    Is there any special reason for coding it? Can't you use one of these damn simple CAD application on Freshmeat?

    Regards,

    fmerges at irc.freenode.net