how to submit a ROI defined by dBox?
Steve Lime
Steve.Lime at DNR.STATE.MN.US
Fri Mar 16 13:23:30 PDT 2007
Hi Eduardo: This is possible once you know how. The coordinates from drawing are held in two
arrays in the dBox object, called x and y. They are held in screen coordinates and need to be
converted to image and then map coordinates before being used. I'll make this more transparent
in the future. Anyhow, you'd do this with code like this:
for (var i=0; i<myDbox.x; i++) {
img_x[i] = myDbox.x[i] - myDbox.offsetx; // convert from screen to image coordinates
img_y[i] = myDbox.y[i] - myDbox.offsety;
map_x[i] = myDbox.extent[0] + img_x[i]* myDbox.cellsize; // convert from image to map coordinates
map_y[i] = myDbox.extent[3] - img_y[i]* myDbox.cellsize;
}
Dbox's polygon drawing does not make the first coordinate the same as the last so you'll have to
do that yourself. Hope this helps.
Steve
>>> On 3/14/2007 at 9:38 AM, in message
<2d1782780703140738m3ca79487y3ce9436665cf4d5e at mail.gmail.com>, Eduardo Patto
Kanegae <epk.lists at GMAIL.COM> wrote:
> Hi folks,
>
> I'm using dBox as my MapServer CGI front end and have enabled draw area
> tool.
>
> Now I'd like to submit the points defined by area tool and then save
> the area as a polygon inside a PostGIS database.
>
> Have someone done something similar? How does dBox handle this area?
> As image coordinates? Or as UTM coordinates?
>
> best
More information about the MapServer-users
mailing list