[Mapserver-users] query
Srinivas Reddy
csr at rboxtech.com
Fri Mar 7 19:10:30 PST 2003
Thanks Mr.Eric. I applied as u said. still i am not getting.
i defined in this way my MAP file layer
LAYER//Layer Def. start
NAME "Boundary"
STATUS ON
CONNECTIONTYPE OGR
CONNECTION "data/Boundary.tab"
TYPE POLYGON
CLASSITEM "NAME"
LABELITEM "NAME"
TEMPLATE "Malaya.html" //I defined here the template
METADATA
"DESCRIPTION" "Daerah"
"RESULT_FIELDS" "Name"
"WMS_TITLE" "Selected Information"
"WMS_ABSTRACT" "more information."
"WMS_SRS" "EPSG:26915"
END
CLASS
COLOR 255 255 200
OUTLINECOLOR 0 0 0
LABEL
MINFEATURESIZE 40
MINDISTANCE 150
POSITION CC
SIZE TINY
COLOR 0 0 200
END
END
End//Layer Def. end
for the above layer i written this code for geting the result
if ( isset($map_x) && isset($map_y) && strcmp($zoomdir, "QUERY_POINT") ==
0 )
{
echo "your at the query entery point just enter<br>";
for ($ilayer=0; $ilayer<=$map->numlayers; $ilayer++)
{
$selLayer = $map->GetLayer($ilayer);
// Pointing the map point to where the user clicked
$mappointq = ms_newpointObj();
$mappointq->setXY($map_x,$map_y);
echo $map_x. "<br>" . $map_y;
//$selLayer->{template} = "bogus.html";
$mappointq->setXY($map->width / 2,$map->height / 2);
$queryResult = $selLayer->queryByPoint($mappointq, MS_MULTIPLE, -1);
// here i am geting this error message " PHP Warning: MapServer Error in
msQueryByPoint(): No matching record(s) found"
echo $queryResult;
}
}
----- Original Message -----
From: "Eric Bridger" <eric at gomoos.org>
To: "Srinivas Reddy" <csr at rboxtech.com>
Cc: "Mapserver List" <mapserver-users at lists.gis.umn.edu>
Sent: Thursday, March 06, 2003 4:58 PM
Subject: Re: [Mapserver-users] query
> You misunderstood my point. Your map file MUST define a TEMPLATE, even
> if the template is not used to display the results. queryByPoint() just
> quits if the layer has no template defined. Adding TEMPLATE "bogus.html"
> to your layer doesn't mean you have to use it. Alternatively you can
> add to your code below:
> $selLayer->{template} = "junk.html";
>
>
> On Thu, 2003-03-06 at 04:34, Srinivas Reddy wrote:
> > Thanks Eric,
> > But i like to display the query resutls in the same page. I
> > written like this
> > $mappointq = ms_newpointObj();
> > $mappointq->setXY($map_x,$map_y);
> > $mappointq->setXY($map->width / 2,$map->height / 2);
> >
> >
> > for ($ilayer=0; $ilayer<=$map->numlayers; $ilayer++)
> > {
> > $selLayer = $map->GetLayer($ilayer);
> >
> > $queryResult = $selLayer->queryByPoint($mappointq, MS_MULTIPLE, -1);
> > }
> >
> > for the above code i did not get any results. So how can i get the
results
> > form the layer? Can anyone help this point.
> >
> > ----- Original Message -----
> > From: "Eric Bridger" <eric at gomoos.org>
> > To: <csr at rboxtech.com>
> > Sent: Wednesday, March 05, 2003 4:54 PM
> > Subject: Re: [Mapserver-users] query
> >
> >
> > You will need to define a TEMPLATE "template.html" in your LAYERS. Even
> > if you do not want to use the templates.html to display the results, you
> > still need to have a TEMPLATE in the layer. The html does not even to
> > exist.
> >
> > Hope this helps.
> > Eric
> >
> >
> > On Wed, 2003-03-05 at 12:45, Srinivas Challa wrote:
> > >
> > > Hi Daniel,
> > > Thanks for the replay, I need ,When I am clicking on map selected at
> > point or in rectangle area content recognitions with PHP. I had written
the
> > map file like this
> > > MAP
> > > NAME "New Demo"
> > > STATUS ON
> > > EXTENT 184861.560567497 88197.0005976087 2380774.92575433
> > 826403.167230631
> > > SIZE 800 480
> > > SHAPEPATH "data"
> > > IMAGECOLOR 255 255 255
> > > UNITS meters
> > >
> > > WEB
> > > IMAGEPATH "/apache/htdocs/tmp/"
> > > IMAGEURL "/tmp/"
> > >
> > > METADATA
> > > "WMS_TITLE" "New Demo"
> > > "WMS_ABSTRACT" "Information system"
> > > "WMS_ACCESSCONSTRAINTS" "none"
> > > "WMS_ONLINERESOURCE" "http://localhost:81/demo/demo.phtml"
> > > "WMS_SRS" "EPSG:26915"
> > > END
> > > END
> > > #
> > > # Start of reference map
> > > #
> > > REFERENCE
> > > STATUS ON
> > > IMAGE "graphics/refreance2.gif"
> > > SIZE 200 80
> > > COLOR -1 -1 -1
> > > OUTLINECOLOR 0 0 255
> > > MARKERSIZE 3
> > > EXTENT 184861.560567497 88197.0005976087 2380774.92575433
> > 826403.167230631
> > >
> > > END
> > >
> > > QUERYMAP
> > > STATUS ON
> > > SIZE 400 400
> > > STYLE HILITE
> > > COLOR 255 0 0
> > >
> > > END
> > > #
> > > # Start of legend
> > > #
> > > LEGEND
> > > KEYSIZE 18 12
> > > LABEL
> > > TYPE BITMAP
> > > SIZE MEDIUM
> > > COLOR 0 0 89
> > > END
> > > STATUS ON
> > > END
> > >
> > > #
> > > # Start of scalebar
> > > #
> > > SCALEBAR
> > > STATUS TRUE
> > > COLOR 0 0 0
> > > IMAGECOLOR 255 255 255
> > > OUTLINECOLOR 0 0 0
> > > UNITS kilometers
> > > INTERVALS 5
> > > SIZE 200 5
> > > STYLE 0
> > > LABEL
> > > SIZE tiny
> > > COLOR 0 0 0
> > > END
> > > END
> > > #
> > > # Start of symbol definitions (we're only using a few)
> > > #
> > > SYMBOL
> > > NAME "circle"
> > > TYPE ELLIPSE
> > > FILLED TRUE
> > > POINTS
> > > 1 1
> > > END
> > > END
> > >
> > > # Start of layer definitions
> > > LAYER
> > > NAME "Boundary"
> > > STATUS ON
> > > CONNECTIONTYPE OGR
> > > CONNECTION "data/Boundary.tab"
> > > TYPE POLYGON
> > > CLASSITEM "NAME"
> > > LABELITEM "NAME"
> > > METADATA
> > > "DESCRIPTION" "Daerah"
> > > "RESULT_FIELDS" "Name"
> > > "WMS_TITLE" "Selected Information"
> > > "WMS_ABSTRACT" "more information."
> > > "WMS_SRS" "EPSG:26915"
> > > END
> > > CLASS
> > > COLOR 255 255 200
> > > OUTLINECOLOR 0 0 0
> > > LABEL
> > > MINFEATURESIZE 40
> > > MINDISTANCE 150
> > > POSITION CC
> > > SIZE TINY
> > > COLOR 0 0 200
> > > END
> > >
> > > END
> > > End
> > >
> > > LAYER
> > > NAME "Fed_Rd"
> > > STATUS ON
> > > CONNECTIONTYPE OGR
> > > CONNECTION "data/Fed_Rd.TAB"
> > > TYPE LINE
> > > #STYLEITEM "AUTO"
> > > CLASSITEM "NAME"
> > > LABELITEM "Name"
> > > METADATA
> > > "WMS_TITLE" "Selected Information"
> > > "WMS_ABSTRACT" "more information."
> > > "WMS_SRS" "EPSG:26915"
> > > END
> > > CLASS
> > > COLOR 255 0 0
> > > #OUTLINECOLOR 255 0 0
> > > LABEL
> > > #MINFEATURESIZE 40
> > > #MINDISTANCE 150
> > > POSITION CC
> > > SIZE tiny
> > > COLOR 10 100 100
> > > #SHADOWCOLOR 80 80 80
> > > #SHADOWSIZE 1 1
> > > END
> > > END
> > > END
> > >
> > > LAYER
> > > NAME "Highway"
> > > STATUS ON
> > > CONNECTIONTYPE OGR
> > > CONNECTION "data/Highway.TAB"
> > > TYPE LINE
> > > # STYLEITEM "AUTO"
> > > CLASSITEM "NAME"
> > > LABELITEM "NAME"
> > >
> > > METADATA
> > > "WMS_TITLE" "Selected Information"
> > > "WMS_ABSTRACT" "more information."
> > > "WMS_SRS" "EPSG:26915"
> > > END
> > >
> > > CLASS
> > > #SYMBOL "MYSYMBOL"
> > > COLOR 46 210 200
> > > LABEL
> > > MINFEATURESIZE 40
> > > MINDISTANCE 150
> > > POSITION CC
> > > SIZE TINY
> > > COLOR 0 800 200
> > > END
> > > END
> > > END
> > >
> > >
> > >
> > > LAYER
> > > NAME "Railways"
> > > STATUS ON
> > > CONNECTIONTYPE OGR
> > > CONNECTION "data/Railway.TAB"
> > > TYPE LINE
> > > STYLEITEM "AUTO"
> > > CLASSITEM "NAME"
> > > LABELITEM "NAME"
> > >
> > > METADATA
> > > "WMS_TITLE" "Selected Information"
> > > "WMS_ABSTRACT" "more information."
> > > "WMS_SRS" "EPSG:26915"
> > > END
> > > CLASS
> > > NAME "Rail Lines"
> > > COLOR 0 0 0
> > > OVERLAYSYMBOL dashed2
> > > OVERLAYCOLOR 0 0 0
> > > OVERLAYSIZE 3
> > > LABEL
> > > MINFEATURESIZE 40
> > > MINDISTANCE 150
> > > POSITION CC
> > > SIZE TINY
> > > COLOR 100 0 200
> > > END
> > > END
> > > END
> > >
> > >
> > > LAYER
> > > NAME "State_Rd"
> > > STATUS ON
> > > CONNECTIONTYPE OGR
> > > CONNECTION "data/State_Rd.TAB"
> > > TYPE LINE
> > > #STYLEITEM "AUTO"
> > > CLASSITEM "NAME"
> > > LABELITEM "NAME"
> > >
> > > METADATA
> > > "WMS_TITLE" "Selected Information"
> > > "WMS_ABSTRACT" "more information."
> > > "WMS_SRS" "EPSG:26915"
> > > END
> > > CLASS
> > > COLOR 180 180 180
> > > LABEL
> > > MINFEATURESIZE 40
> > > MINDISTANCE 150
> > > POSITION CC
> > > SIZE TINY
> > > COLOR 220 100 0
> > > END
> > > END
> > > END
> > > # Seven Layer Under tesing Process... sucessed
> > > LAYER
> > > NAME "Towns"
> > > STATUS ON
> > > CONNECTIONTYPE OGR
> > > CONNECTION "data/ Towns.TAB"
> > > TYPE POINT
> > > CLASSITEM "TOWN"
> > > LABELITEM "Town"
> > >
> > > METADATA
> > > "DESCRIPTION" " Towns"
> > > "RESULT_FIELDS" "Town"
> > > "WMS_TITLE" "Selected Information"
> > > "WMS_ABSTRACT" "more information."
> > > "WMS_SRS" "EPSG:26915"
> > > END
> > > CLASS
> > > SYMBOL 'symbols/town.gif'
> > > LABEL
> > > MINFEATURESIZE 100
> > > MINDISTANCE 450
> > > POSITION LC
> > > SIZE TINY
> > > COLOR 40 100 40
> > > END
> > > END
> > > END
> > >
> > >
> > >
> > > # End of the map
> > > END
> > > For the above map Script is working fine. But while I am querying I
did
> > not getting the results. How can query the map using PHP at point and
> > selected rectangle area.
> > > Is any one can send the script for this.
> > >
> > > In this project i am not using applets. Just Map querying on 7 layers
> > using php.
> > >
> > > srinivasa reddy Challa
> > >
> > >
> > >
> > > Srinivas Reddy wrote:
> > > >
> > > > Now am new to this technologies but I had done some of project with
> > > > the reference of DM solutions map reference. In DM
> > > > solutions they are done using SHP data files. But I am using
"*.Tab"
> > > > data. How can I query the content of the "*.TAB"layers
> > > > using php and mapscript. This is my problem. This is my email id :
> > > > csr at rboxtech.com or reddy_challa at yahoo.com
> > >
> > >
> > > You will have to provide more details on what you are trying to do
> > > exactly if you want anyone to be able to help.
> > >
> > > If by "query the contents of .tab layers" you mean clicking on a map
> > > image and selecting features from a TAB layer then this works the same
> > > way for shapefiles and for .tab files. The only difference is that
you
> > > need MapServer with OGR support, and you define an OGR CONNECTION in
> > > your LAYER. For more details on using OGR CONNECTIONS, see the OGR
> > > HOWTO at http://mapserver.gis.umn.edu/doc36/ogr-howto.html
> > >
> > > Daniel
> > > --
> > > ------------------------------------------------------------
> > > Daniel Morissette morissette at dmsolutions.ca
> > > DM Solutions Group http://www.dmsolutions.ca/
> > > ------------------------------------------------------------
> > > _______________________________________________
> > > Mapserver-users mailing list
> > > Mapserver-users at lists.gis.umn.edu
> > > http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > Mapserver-users mailing list
> > > Mapserver-users at lists.gis.umn.edu
> > > http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> > >
> >
> >
> >
> > _______________________________________________
> > Mapserver-users mailing list
> > Mapserver-users at lists.gis.umn.edu
> > http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> >
>
>
>
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
More information about the MapServer-users
mailing list