[mapserver-users] Re: Map Server

Daniel Morissette morissette at dmsolutions.ca
Thu May 2 11:04:17 EDT 2002


Hi Stephen,

Sorry for the late reply (I'm just crazy busy as usual).  I'll CC: my
reply to the mapserver-users list since the information that follows may
be of general interest to some users.

There are a few ways this could be done, I'll suggest a few here and I'm
sure other users could come up with more ideas.  It depends very much
on the number of points that you have in your database and whether this
database is updated in real time or is static, and the number of points
to display in a single request.

If your database is static then the simplest thing to do is to export it
as a shapefile, and then use that shapefile with MapServer... MapServer
can do spatial searches on a huge indexed file (see shptree) faster than
you can do them with your database, and once the spatial filter is
applied, the attribute filter shouldn't be too expensive.  Again, there
are a number of ways to export your database to shapefile, ranging from
specialized software like FME (http://www.safe.com/) to custom scripts
written in PHP (using MapScript), or even in VB (write a MIF/MID ASCII
file and then convert it to .SHP using 'ogr2ogr', or even use the
mif/mid directly in MapServer via OGR if it's relatively small, or
create a TAB file and use it directly... more on this below)

If exporting the database is not an option, then you could pass point
coordinates in the URL to the mapserv CGI... but this works only for
small number of points, say less than 10 for instance...

With small number of points, it may also be possible to create a
temporary copy of your MapServer mapfile in which you insert inline
features directly in the mapfile from VB... I'm less familiar with
inline features but you may be able to find more infos on the MapServer
website or in the mapserver-users list archive.

Finally, if you cannot export the database but the number of points in a
given requests is relatively large, then you could have your ASP page
produce a temporary shapefile, mif/mid file, or TAB file, and include
that temporary layer in your MapServer mapfile on the fly (via the URL
to the mapserv CGI).  The main step here is to create the temporary
file:

1- Creating shapefiles from VB: I don't know of any lib to do that, but
there must be some... a search on the web might return some interesting
results

2- Creating a MIF/MID file from VB: MIF/MID is MapInfo's interchange
format (ASCII format), it is well documented and is supported by
MapServer with the OGR option.  However, since it's an ASCII format, it
is suitable only for relatively small datasets, less than 100 or 200
points for instance. 

3- Creating a MapInfo TAB file from VB: this is MapInfo's binary format,
highly optimized, also supported via the OGR option in MapServer and
almost as fast as shapefiles.  The MITAB library can be used to create
TAB files from VB... see:
http://groups.yahoo.com/group/mitab/message/266

You'll find links to MITAB, the MIF/MID specs, and shapelib in the
following page: http://pages.infinit.net/danmo/e00/index.html
and all the details on using OGR-supported formats in MapServer can be
found in the OGR-HOWTO: http://mapserver.gis.umn.edu/doc/ogr-howto.html

I hope that helps get you started, as you can see it's all possible and
there are lots of options but each of them require some knowledge of one
tool or another.  So if this application is critical to you and you need
more help then you can buy some support time from us and we can have
someone work on this with you and answer any further questions in
details.

Best Regards,

Daniel
-- 
------------------------------------------------------------
 Daniel Morissette               morissette at dmsolutions.ca
 DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------
  Don't put for tomorrow what you can do today, because if 
      you enjoy it today you can do it again tomorrow.


"Stephen D. King" wrote:
> 
> Dear Daniel,
> 
> I am still struggling to find a solution to my MapServer ASP problem. I'm
> sorry to email you again, but I wondered whether you have a moment to give
> me a few pointers. I'm hoping to be able to finish the site off in a short
> while.
> 
> The following are my database fields (MS Access). At the moment I am
> searching the database by the X and Y coordinates and also Species and
> Common Name. As I mentioned before I would like to be able to plot
> distribution maps based on the results of a search - e.g. all matches for a
> particular species.
> 
> Many thanks for your time,
> 
> Stephen
> 
> SpeciesID - AutoNumber
> SearchSpecies - Text
> Species - Text
> CommonName - Text
> RecSurvey - Text
> Designated - text
> DateStart - Date/Time
> DateEnd - Date/Time
> Xcoord - Number
> Ycoord - Number
> 
> At 11:58 PM 4/10/2002 -0400, you wrote:
> >Stephen,
> >
> >Yes, there is always a way... ;)   Unfortunately I'm on the road for the
> >week and can't write a comprehensive reply right now... so you may want
> >to send your question to the list where a few users who have done this
> >already can help you... otherwise I'll try to reply when I'm back next
> >week.
> >
> >Daniel
> >
> >"Stephen D. King" wrote:
> > >
> > > Dear Daniel,
> > >
> > > I am currently working on a web site that includes a database of different
> > > species that have been recorded in the Grampian region of Scotland. Each
> > > species record in the database also has a grid coordinate associated with
> > > it. At the moment, I can search the database and produce a map showing the
> > > location of a particular species using MapServer. However, what I would
> > > like to be able to do is search the database by species, and then produce a
> > > distribution map for that particular species - showing all the records for
> > > that species rather than just one. This means that I will have to produce a
> > > shapefile on the fly from my database.
> > >
> > > I understand that this can be done with MapScript and PHP. However, I am
> > > developing the site on an IIS 5.0  server and I am using ASP as well as an
> > > MS Access database. My current web host does not support PHP and will not
> > > install it either.
> > >
> > > Is there any way that you know of that this can be done using ASP? I have
> > > tried searching the support list server and submitting a request to it but
> > > I haven't had any success. I have only just set up the web site and do not
> > > really want to lose money by having to transfer to a host who supports PHP
> > > at this stage.
> > >
> > > Any help you can give me would be greatly appreciated. If you are
> > > interested in the site you can access it at
> > http://www.nesbrec.org.uk/home.asp
> > >
> > > Kind regards,



More information about the mapserver-users mailing list