[mapserver-users] Another mailing list for MapServer?

Jim Strevinas voas_acc at hotmail.com
Fri May 8 17:31:57 EDT 2009


Hi Peter,
   Please correct me if i am wrong. I saw earlier that you use Bill Kropla's
   example application. Thus you use a NON-spatial DB which keeps the
   longitute, latitude data as floats. Afterwards you manually query the DB 
   as you posted and use the results to populate the table. After that (according to
    the Kropla example) a function like the one below is used:
   
   function AddPoints ( $map, $qresult ) {
     $this_layer = $map->getLayerByName('poi');
     $i = 0;
     foreach($qresult as $row) {
        $poi[$i] = ms_newPointObj();
        $ln[$i] =  ms_newLineObj();
        $shp[$i] = ms_newShapeObj(MS_SHAPE_POINT);
        $poi[$i]->setXY($row[3],$row[2]);
        $ln[$i]->add($poi[$i]);         
        $shp[$i]->add($ln[$i]);
        $shp[$i]->set(index, $row[0]);
        $this_layer->addFeature( $shp[$i] );
        $i++;
     }
     return;
} // end AddPoints

This one adds the features to the layer. Now, if you use the above
code snippet to populate the layer, you do not add the NON-SPATIAL
values to the features created. Thus, the EXPRESSION can not find
the associated fieldname (fiscal) in order to classify the features and 
finally draw different colors for the symbols.

If it is the case, it is easy to add fieldnames to the features. If you already
took care of that, we must search the solution somewhere else. 

Waiting for your response

Regards, 
  Jim


----------------------------------------
> Date: Fri, 8 May 2009 09:02:07 -0700
> From: peter_rose at hotmail.com
> To: mapserver-users at lists.osgeo.org
> Subject: Re: [mapserver-users] Another mailing list for MapServer?
>
>
> Hi,
>
> A PHP script accesses MySQL to retrieve dynamic information, and uses the
> PHP MapScript APA to render a map. It displays a map of the UK with shires,
> rivers etc. from the content of several shapefiles. Each point (POI) of
> interest is renders directly from the geographical coordinates stored in the
> MySQL Database.
> The user is able to search the database directly on the website by sending a
> Select statement which in turn generates the pages.
>
> You can try the website yourself by going to -
> http://mapserver.cch.kcl.ac.uk/pase/pasemap2.php
> If you search for the Latin Name = Edward, you should get 8 results.
> This site is still very much a work in progress and things change may change
> at any time!
>
> What I want to do is to display the dots on the map in various colours and
> sizes according to the fiscal values in the database. Fx. So that all values
> over 3 are large and red while everything under 3 is small and green.
> The fiscal values are kept in a Float field in the MySQL database.
> The important thing here is that the data is kept in my MySQL database, not
> in a shapefile, as I have to be able to change it from time to time.
> I know that if these values had been kept in the shapefile I could just
> insert the Expression ([fiscal] < 3) in the mapfile as my example
> illustrate.
> However, this doesn’t work with MySQL.
>
> My connection to the database takes place in the PHP script like you would
> normally do it (see bottom of page). As for the Mapfile, only the section I
> have already shown deals with the points of interest. The rest has to do
> with the shapefiles, scale, legend etc. and are therefore not relevant for
> this question.
>
> Since the layer is rendered dynamically from a database it does not need a
> DATA statement. It can still display the points as you can see from the
> website.
> As for the expressions not working, what I mean is that only the first class
> is shown (here it's the "Large fiscal" class with a red dot). But the
> filtering hasn't taken place so all query results are shown not just the  and they are all red. Mapserver therefore seems to ignore the expression all
> together. It also works without the expression. It makes no difference
> whether or not the expression is there.
>
> Thank you everyone for helping me with this one. I hope a solution to my
> question will be helpful to other MapServer user.
> Hope you all have a good weekend.
> Best regards,
> Peter


_________________________________________________________________
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/


More information about the mapserver-users mailing list