[Mapserver-users] Using the shapefile FID in a query

Pericles S. Nacionales nacional at cbs.umn.edu
Mon Jun 28 12:27:53 PDT 2004


Mark,

It looks like you're using ArcMap... FID (the object id) is an ArcMap
field and doesn't exist in the DBF file.  What you can do is add a new
field to your database and see if you can copy the values of FID to this
new field, perhaps call it FID2 or ShapeID.  You can then use FID2
instead of FID in your queries.  Be aware that if you edit your
shapefile, the new field could become out of sync with FID.

-Perry

On Mon, 2004-06-28 at 13:14, Huey Brantley wrote:
> Do you get a OBJECTID field returned? If so, that's the FID.
> 
> Steve Lime wrote: 
> > Can you share a shapefile? Did you create the FID field or is some other piece of software reporting its existance? ArcView will show a sequential number but that's not part of the shapefile. You might also share your script, or at least a bit of it. Queries do return an index number and that can be used to retrieve features individually. I assume the INDEXQUERY mode of the CGI program is also present in MapScript using something queryByIndex method...
> > 
> > Steve
> > 
> >   
> > > > > "Mark Adams" <markadams at cuestasys.com> 06/28/04 11:52 AM >>>
> > > > >         
> > I'm puzzled over the behaviour of mapserver in returning query results
> > from shapefiles. It appears the FID field which is present in all of the
> > shape files I'm using does not get returned by mapserver when we use any
> > of the mapscript query functions. There is no error, the field simply
> > isn't present in the return value. Is this by design, and is there a way
> > around this?
> >  
> > This is causing me trouble as I need to have a generic way of
> > identifying a specific (unique) feature. For example, if I query a layer
> > and get back a list of 8 results from that query, I want to present
> > these to the user and give them the option of separately clicking on and
> > zooming to each of those items. To zoom and highlight a specific item I
> > need to use the FID * it's the only unique key I can count on. 
> >  
> > Thanks in advance.
> >  
> > ------------------------------
> > Mark Adams
> > Business & Systems Analyst
> > Cuesta Systems Inc.
> > 5230 South Service Road
> > Burlington, ON L7L 5K2
> > Phone: 905-333-4544 x14
> > Fax: 905-333-0455
> > Email: markadams at cuestasys.com
> >  
> > 
> > 
> > _______________________________________________
> > Mapserver-users mailing list
> > Mapserver-users at lists.gis.umn.edu
> > http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> > 
> >   
-- 
Pericles S. Nacionales

Conservation Biology Program
University of Minnesota
URL:    http://hypnos.cbs.umn.edu/~pnaciona/
E-Mail: nacional at cbs.umn.edu
Phone:  612 624 6713





More information about the MapServer-users mailing list