MapScript Shapefile Object

Stephen Lime steve.lime at dnr.state.mn.us
Tue May 9 15:26:31 EDT 2000


Presumably there is another mechanism to filter points before they
are fetched, ala SQL. ShapeObj and pointObj are nothing more than
containers for storing the spatial information. There is no attribute
component what so ever. That doesn't mean they can't be part of
larger structures that integrate the two types of attributes. Then you
can do whatever your particular scripting language supports. MapScript
has no provision for searching a list of features outside the shapefile
environment. The functions to implement those types of operations
are in place as distance and intersection methods. That sort of processing
should only really be needed when accessing data that is not part of
someother management system (i.e. RDMSes) like ascii files. 

Steve

Stephen Lime
Internet Applications Analyst

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937

>>> Daniel Morissette <danmo at videotron.ca> 05/09/00 01:31PM >>>
Stephen Lime wrote:
> 
> The numshapes property is read only and is not kept up-to-date,
> neither is the bounding box. Some internal parts of shapelib maintain
> that information. The shapefile is not actually complete until the
> mapscript object referencing it is dereferenced. At that point the
> shapefile header is written to disk. Re-reading it now populates the
> bounds and numshapes properties properly. That's how it works for
> now and it could change.
> 
> You don't have to actually create shapefiles to render shapes gathered
> from external databases. It's actually more work. Instead you can use
> the pointObj and shapeObj draw methods to do that. Works pretty good
> and no disk access is necessary so it's faster.
> 

How about querying?  If I select a set of records from an SQL database
that contain LAT/LON coordinates and only want to map those points, this
can probably be done the way you suggest above.

However, is there any way to query the same set of points in memory
without creating a shape file on disk?  My main concern is that I don't
think shapes in memory carry any kind of attribute information (or maybe
I overlooked that?), so even if I could query them in memory, how could
I keep the link between the shapes in memory and the SQL records in
order to display info from the database in response to the query?

Any ideas about that?  Or maybe it's just some parts of the shape object
handling in MapScript that I have overlooked?

Thanks,
-- 
------------------------------------------------------------
 Daniel Morissette                       danmo at videotron.ca 
              http://pages.infinit.net/danmo/ 
------------------------------------------------------------
  Don't put for tomorrow what you can do today, because if 
      you enjoy it today you can do it again tomorrow.





More information about the mapserver-users mailing list