Title: MAPSERVER-USERS Digest - 22 Jun 2006 to 23 Jun 2006 (#2006-176)
Luis,

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:
Skip repetitive navigational links
L-Soft - Home of the LISTSERV mailing list manager LISTSERV(R) 14.3

MAPSERVER-USERS Digest - 22 Jun 2006 to 23 Jun 2006 (#2006-176)


Table of contents:

  1. ERROR: column 'oid' does not exist
  1. No query layer defined
  1. Having trouble with running a demo
  1. templete problem
  1. query raster layer
  1. NQUERY problem
  1. msWMSLoadGetParams
  1. Mapscript ,Mono, Apache and Linux : a great story (heap corruption with geos)
  1. Thread-safety in mapscript_csharp.dll?
  1. Deleting from a shapefile
  1. JavaMapscript SIGSEGV
  1. WMS Layer Problem
  1. how to build a geofence app.
  1. Mapscript C# compilation
  1. LEGEND + CLASS
  1. Class _expression_ and PostGIS



Powered by LISTSERV(R) 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

Reply via email to