Stephen is on the right track here. I did this at a previous company by letting the user zoom/pan to the ROI, then I had the user click 2 points; one the center point and the other a point on the wanted "edge" of the ROI. I then used the wz_jsgraphics.js library to draw both a circle, the geofence, and its bounding box based off of these 2 points, which created the radius of the circle. Once the user was satisfied, they could submit the geofence to the server for persistence.
This method is easy if you only need square or circular geofences, but if you need irregularly shaped polygons then you'll have to have your users digitize points, just like Stephen said previously.
Here's some sample code for drawing the geofence using wz_jsgraphics.js:
lyr.drawLine(x1,y1,x2,y2);
lyr.paint();
lyr.setColor("#ff0000");
var radius = Math.sqrt( Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
var x = x1 - radius;
var y = y1 - radius;
var w = radius * 2;
var h = w;
lyr.drawEllipse(x, y, w, h);
lyr.paint();
lyr.setColor("#00ff00");
lyr.drawRect(x, y, w, h);
lyr.paint();
On Sat, 2006-06-24 at 00:00 -0500, MAPSERVER-USERS automatic digest system wrote:
![]()
![]()
MAPSERVER-USERS Digest - 22 Jun 2006 to 23 Jun 2006 (#2006-176)
Table of contents:
- ERROR: column 'oid' does not exist
- No query layer defined
- Having trouble with running a demo
- templete problem
- query raster layer (2)
- NQUERY problem
- msWMSLoadGetParams (2)
- Mapscript ,Mono, Apache and Linux : a great story (heap corruption with geos)
- Thread-safety in mapscript_csharp.dll? (5)
- Deleting from a shapefile
- JavaMapscript SIGSEGV
- WMS Layer Problem
- how to build a geofence app. (3)
- Mapscript C# compilation (4)
- LEGEND + CLASS
- Class _expression_ and PostGIS
- ERROR: column 'oid' does not exist
- Re: ERROR: column 'oid' does not exist (06/22)
From: Tyler Mitchell <[EMAIL PROTECTED]>
- No query layer defined
- No query layer defined (06/23)
From: absar ali <[EMAIL PROTECTED]>
- Having trouble with running a demo
- Re: Having trouble with running a demo (06/23)
From: Daniel Goetz <[EMAIL PROTECTED]>
- templete problem
- templete problem (06/23)
From: absar ali <[EMAIL PROTECTED]>
- query raster layer
- Re: query raster layer (06/23)
From: "Bart van den Eijnden (OSGIS)" <[EMAIL PROTECTED]>- Re: query raster layer (06/23)
From: Giorgio Libert <[EMAIL PROTECTED]>
- NQUERY problem
- NQUERY problem (06/23)
From: DjwStone <[EMAIL PROTECTED]>
- msWMSLoadGetParams
- Re: msWMSLoadGetParams (06/23)
From: Marcos Cobea <[EMAIL PROTECTED]>- Re: msWMSLoadGetParams (06/23)
From: "Bart van den Eijnden (OSGIS)" <[EMAIL PROTECTED]>
- Mapscript ,Mono, Apache and Linux : a great story (heap corruption with geos)
- Re: Mapscript ,Mono, Apache and Linux : a great story (heap corruption with geos) (06/23)
From: Tamas Szekeres <[EMAIL PROTECTED]>
- Thread-safety in mapscript_csharp.dll?
- Thread-safety in mapscript_csharp.dll? (06/23)
From: Jeff Dege <[EMAIL PROTECTED]>- Re: Thread-safety in mapscript_csharp.dll? (06/23)
From: Umberto Nicoletti <[EMAIL PROTECTED]>- Re: Thread-safety in mapscript_csharp.dll? (06/23)
From: Tamas Szekeres <[EMAIL PROTECTED]>- Re: Thread-safety in mapscript_csharp.dll? (06/23)
From: Jeff Dege <[EMAIL PROTECTED]>- Re: Thread-safety in mapscript_csharp.dll? (06/24)
From: Tamas Szekeres <[EMAIL PROTECTED]>
- Deleting from a shapefile
- Deleting from a shapefile (06/23)
From: Antonio Iandolo <[EMAIL PROTECTED]>
- JavaMapscript SIGSEGV
- Re: JavaMapscript SIGSEGV (06/23)
From: Tamas Szekeres <[EMAIL PROTECTED]>
- WMS Layer Problem
- WMS Layer Problem (06/23)
From: "M.L. Jackson" <[EMAIL PROTECTED]>
- how to build a geofence app.
- how to build a geofence app. (06/23)
From: Luis Trevio Huerta <[EMAIL PROTECTED]>- Re: how to build a geofence app. (06/23)
From: Stephen Woodbridge <[EMAIL PROTECTED]>- Re: how to build a geofence app. (06/23)
From: Luis Trevio Huerta <[EMAIL PROTECTED]>
- Mapscript C# compilation
- Mapscript C# compilation (06/23)
From: rock well <[EMAIL PROTECTED]>- Re: Mapscript C# compilation (06/24)
From: Tamas Szekeres <[EMAIL PROTECTED]>- Re: Mapscript C# compilation (06/23)
From: rock well <[EMAIL PROTECTED]>- Re: Mapscript C# compilation (06/24)
From: Tamas Szekeres <[EMAIL PROTECTED]>
- LEGEND + CLASS
- LEGEND + CLASS (06/23)
From: salah jubeh <[EMAIL PROTECTED]>
- Class _expression_ and PostGIS
- Class _expression_ and PostGIS (06/24)
From: Nigel Gilbert <[EMAIL PROTECTED]>
Browse the MAPSERVER-USERS online archives.
email message attachment -------- Forwarded Message --------
From: Tyler Mitchell <[EMAIL PROTECTED]>
Subject: Re: ERROR: column 'oid' does not exist
Date: Thu, 22 Jun 2006 22:56:38 -0700
On 22-Jun-06, at 8:50 PM, Aaron Koning wrote: > If you imported the spatial layer with shp2pgsql or OGR programs, > their should be a unique id field already (e.g. 'gid' with > shp2pgsql). You can tell MapServer to use this unique id field > instead of oid in the LAYER -> DATA variable of your MapFile. > > Example: > DATA "the_geom FROM roads AS foo USING UNIQUE gid" > That's a much better - thanks Aaron. I'm told by postgresql gurus not to ever use the oid... that it should only be used for internal database key purposes and cannot be relied on as stable. Oh well, thanks for pointing out a better option. Tyler
email message attachment -------- Forwarded Message --------
From: absar ali <[EMAIL PROTECTED]>
Subject: No query layer defined
Date: Fri, 23 Jun 2006 00:30:58 -0700
GRRRRRRRRRRRRRR, i am using the following line to query the map window.open("/cgi-bin/mapserv.exe?map=karachi.map&mode=ITEMQUERY&qstring=charge&layer=charge_region"); actually stive lime gave me this, but its giving following error "msQueryByAttribute():General error message. No query layer defined" below is my map file, please check is there any thing wrong in my map file. I am using ka-map as my map client. my kamap is woring fine it displays all the layers but the hell query is not woring another thing my maps are not georeferenced so i cant use QueryByPoint. Please help me n guide me i am very depressed. Regards, Absar Ali ____________________________________________________ NAME Karachi STATUS ON SIZE 800 600 SHAPEPATH "karachiShape" WEB IMAGEPATH "C:/tmp/" IMAGEURL "C:/tmp/" END EXTENT 40.2283 -5.55177 49.7201 1.8823 UNITS dd IMAGECOLOR 255 255 255 IMAGETYPE png QUERYMAP STATUS ON # the map is queryable by default STYLE HILITE # the selected object is highligthed COLOR 255 0 0 SIZE -1 -1 END LEGEND KEYSIZE 18 12 LABEL TYPE BITMAP SIZE MEDIUM COLOR 0 0 89 END STATUS ON END LAYER NAME charge_region TEMPLATE "template/ka.html" METADATA "queryable" "true" END TYPE POLYGON STATUS ON DATA CHARGE_region LABELITEM "name" CLASS NAME "CHARGE_region" COLOR 146 154 155 OUTLINECOLOR 43 170 115 LABEL MINFEATURESIZE 40 MINDISTANCE 150 POSITION CC SIZE TINY COLOR 0 0 0 END END END LAYER NAME circle_region TEMPLATE "template/ka.html" METADATA "queryable" "true" END TYPE POLYGON STATUS OFF DATA CIRCLE_region LABELITEM "name" CLASS NAME "CIRCLE_region" COLOR 90 15 155 OUTLINECOLOR 200 205 133 LABEL MINFEATURESIZE 40 MINDISTANCE 150 POSITION CC SIZE TINY COLOR 0 0 0 END END END LAYER NAME important_locations_point METADATA "queryable" "true" END TYPE POINT STATUS OFF DATA "IMPORTANT LOCATIONS_point" CLASS NAME "IMPORTANT LOCATIONS_point" END END LAYER NAME town_region TEMPLATE "template/ka.html" METADATA "queryable" "true" END TYPE POLYGON STATUS OFF DATA TOWN_region LABELITEM "name" CLASS NAME "TOWN_region" COLOR 77 224 186 OUTLINECOLOR 244 237 138 LABEL MINFEATURESIZE 40 MINDISTANCE 150 POSITION CC SIZE TINY COLOR 0 0 0 END END END LAYER NAME town_text TEMPLATE "template/ka.html" METADATA "queryable" "true" END TYPE POINT STATUS OFF DATA TOWN_text CLASS NAME "TOWN_text" END END LAYER NAME union_council_region TEMPLATE "template/ka.html" METADATA "queryable" "true" END TYPE POLYGON STATUS ON DATA "UNION COUNCIL_region" LABELITEM "name" CLASS NAME "UNION COUNCIL_region" COLOR 37 118 61 OUTLINECOLOR 220 54 199 LABEL MINFEATURESIZE 40 MINDISTANCE 150 POSITION CC SIZE TINY COLOR 0 0 0 END END END END
|
Mark Thomas Sun Certified Java 5 Programmer Sun Certified Java 2 Programmer Sun Certified Web Component Developer |
