# Using a LocatorPane

I have a network of a power grid where the edge are the power lines and the vertices are loads or generators. I was wondering how I can import an image into Mathematica to derive some sort of coordinate system to calculate some topological properties that are related to distance and position using Monte Carlo Cooling methods and other methods of this sort. The code below is giving me back errors that are shown below.

im = Import["C:\Research\Pictures\FloridaPowerGrid.jpg"];
Module[{picturesize, i, bigger, imagesizes},
picturesize = {1038, 1386};
values = {};
i = 1;
imagesizes = ImageDimensions[im]; bigger = 1;
DynamicModule[{pt = {0, 0}},
If[imagesizes[[1]] < imagesizes[[2]], bigger = 2];
TableForm@{
Button["Record!", AppendTo[values, {i, pt}]; i++;],
LocatorPane[Dynamic@pt,
Dynamic @ Graphics[
Join[
{Inset[im, {0, 0}, {0, 0}, {1, 1}]},
Flatten[{Blue, Disk[#[[2]], .01], White, Text[#[[1]], #[[2]]]} & /@ values]],
PlotRange ->
{{0, imagesizes[[1]]/imagesizes[[bigger]]},
{0, imagesizes[[2]]/imagesizes[[bigger]]}},
ImageSize -> picturesize]],
Dynamic[N @ pt],
Dynamic[MatrixForm@values]}]]


-
the short answer is yes but the long answer is complicated and requires more info. Are you wanting to use locators to get coords of points on the image? If so this post might offer some ideas: mathematica.stackexchange.com/questions/3831/… –  Mike Honeychurch Jun 12 at 0:06
The gist of my code is trying to set up a coordinate system to get relative distances for a power grid system. pastebin.com/sMJWJNfP –  David Jun 12 at 0:42
I put the pastebin to my code above for help to see if the code will suffice for my needs –  David Jun 12 at 0:42
This is what I get as my error message. imgur.com/V3eQlib –  David Jun 12 at 1:40
It is not a good idea to have Module values that you intend to use dynamically. Get rid of Module and bring everything into your dynamic module and try again –  Mike Honeychurch Jun 12 at 2:43