Hi
I wrote earlier about using coordinates from an image map.
I have gone through and mapped the coordinates from the image itself, making as many states on the map squares as I could (to make life easier). Two of the States have diagonal borders and cannot be made into plain rectangles, so I have developed the following to parse coordinates:
if ($state_x <= "98" && $state_y <= "213"){
$state1 = "wa";
} elseif (($state_x >= "99" && $state_x <= "153") && ($state_y <= "98")) {
$state1 = "nt";
} elseif (($state_x >= "99" && $state_x <= "170") && ($state_y >= "99" && $state_y <="213")) {
$state1 = "sa";
} elseif (($state_x >= "154" && $state_x <= "248") && ($state_y <="114")) {
$state1 = "qld";
} elseif (($state_x >= "171" && $state_x <= "248") && ($state_y >= "115" && $state_y <="170")) {
if (($state_x >= "171" && $state_x <= "185") && $state_y > "150") {
$state1 = "vic";
} elseif ($state_x = "186" && $state_y >= "151") {
$state1 = "vic";
} elseif ($state_x = "187" && $state_y >= "152") {
$state1 = "vic";
} elseif ($state_x = "188" && $state_y >= "153") {
$state1 = "vic";
} elseif ($state_x = "189" && $state_y >= "154") {
$state1 = "vic";
} elseif ($state_x = "190" && $state_y >= "155") {
$state1 = "vic";
} elseif ($state_x = "191" && $state_y >= "156") {
$state1 = "vic";
} elseif (($state_x >= "192" && $state_x <= "209") && $state_y >= "158") {
$state1 = "vic";
} elseif ($state_x = "210" && $state_y >= "159") {
$state1 = "vic";
} elseif ($state_x = "211" && $state_y >= "161") {
$state1 = "vic";
} elseif ($state_x = "212" && $state_y >= "163") {
$state1 = "vic";
} elseif ($state_x = "213" && $state_y >= "165") {
$state1 = "vic";
} elseif ($state_x = "214" && $state_y >= "167") {
$state1 = "vic";
} elseif (($state_x = "215" || $state_x = "216") && $state_y >= "169") {
$state1 = "vic";
} elseif ($state_x >= "217" && $state_y >= "171") {
$state1 = "vic";
} else {
$state1 = "nsw";
}
} else {
$state1="otherstates";
}
echo $state1;
Seems there may be some problem with the logic here though, because when parsed, regardless of where I have directed the variable $state1 to be even in relation to exact points, it is ignored. "state" nsw starts at y=149 for any x coord.
aahhhhhhhhhh..maybe I have overlooked syntax? or maybe I just can't do it this way...maybe ther is a simpler way to do it?
my mind is going numb...can anyone help?
Ray