[Mapserver-users] Re: Implementing querying functionality using Perl MapScript

AMC Story s9646183 at sms.ed.ac.uk
Tue Jul 15 07:30:07 EDT 2003


Thanks, I'll try to be a bit more specific this time :)

Basically, I'd like to be able to select a point object from the map, and then 
display a new pop-up box, which would give the user all the information about 
that point feature which is stored in the dbf file, and perhaps also include a 
map in this pop up window which would highlight the selected feature in a 
different colour or with a different symbol.  Not quite sure how to do the pop-
up box thing yet, but I seem to remember some tips on this in the archive, so 
I'll look at that once I've figured out how to do the basics.

So far, I've got to the point where I can display the shapeindex of the 
selected point, 

ie. $rec_no = $result_feature->{shapeindex};

but I'm now struggling to work out how to access the attributes of the feature 
in the dbf file with that record number.  In some of the examples, the XBase 
module is used.  I don't seem to be able to access this (and I've tried xdb and 
Xbase too) but I could possibly get it installed if it's necessary.

I was wondering though whether I could use methods of the DBFInfo class or some 
of the miscellaneous functions such as msDBFReadStringAttribute which I saw 
listed on the Perl MapScript Reference some time ago, but which now seem to 
have disappeared.  Are these still supported, and is there any documentation 
somewhere for them?

If using the XBase module is the only/best way to go, could someone please give 
me the corrent name and version number of the module I should be looking for, 
or even better, where I might get it?

Thanks very much,
Ali 


Quoting pkishor_98 <pkishor at geoanalytics.com>:

> --- In mapserver-users at yahoogroups.com, AMC Story <s9646183 at s...>
> wrote:
> > Hi there everyone,
> > 
> > I've been using Perl MapScript to develop the interface 
> > of my application, and  am now wanting to implement the 
> > querying functionality that I had going with 
> > the old mapserver CGI version, but now with MapScript.  
> 
> could you elaborate more on --
> 
> - what have you already developed with Perl/Mapscript; and
> - what you mean by "querying functionality"
> 
> Until you do that, I am going to assume you mean identifying a feature
> based on the user's mouse-click.
> 
> > I was wondering if there are any examples of the code
> > needed to do this, as I can't seem to find 
> > anything more than very brief (and apparently incorrect!) 
> > snippets in the 
> > archives.  
> 
> which archives did you look at? There are several very nice examples
> on the wiki, and in the Perl/Mapscript docs. The best, most complete
> example is the mapquakes.pl script. It shows you the building blocks.
> 
> Briefly... you capture the mouse clicks and use them to create the new
> map envelope and generate a new image. If you are querying... you once
> again use the mouse clicks to get the shapeindex and then get its
> associated attribute data from either the <shape>.dbf or a related
> external database table. Keep in mind, the mouse clicks would be
> imagespace, and will have to be converted to geographic space before
> doing anything with them.
> 
> There are definitely fewer ready-to-use, code capsules for
> Perl/Mapscript, and some of us have talked about remedying the
> situation. Most Perl/Mapscript users, however, have found the existing
> examples quite helpful in guiding them and setting them on the correct
> path to developing their own code. Each application is different, and
> it is hard to provide a demo that will work for everyone.
> 
> Please look at the above mentioned examples on the wiki, and then if
> you have specific questions come and ask us. One of us will be able to
> help you.
> 
> 
> 
> _______________________________________________
> 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