labelObj in mapscript ?

Stephen Lime steve.lime at dnr.state.mn.us
Tue Jun 27 20:13:18 PDT 2000


What xbase type is LEVEL_RANGE? All equality tests are done using string comparisons. With integers and char fields this is no problem but with floats it can become a hassle although equality tests with floats have been rare in my travels. What happens with that the database coughs up "60.00000" which doesn't match "60". Would've thought the logical expression:

  ([LEVEL_RANGE] = 60.0)

would've worked. Will have to test that.

Anyway, if LEVEL_RANGE is a float then using a regex like EXPRESSION /^60.*/ might solve the problem.

If this suggestion doesn't help then please pass along the shapefile (or a portion thereof).

Steve

<<< "Doyon, Jean-Francois" <Jean-Francois.Doyon at CCRS.NRCan.gc.ca>  6/27  3:07p >>>
Thanks, that fixed the problem right away !

Now, same KINd of problem, but with a twist.

I am now trying to map elevation levels.

In order to do this, I set a CLASSITEM of LEVEL_RANGE in my case.

Then I define various classes with different EXPRESSION statements. Right
now I just have one that says "60", which basically would mean : draw alll
the polygons that have a LEVEL_RANGE of 60, right ?

Well, no such luck. It keeps drawing the whole country ! (or, at times,
nothing at all).

So, what am I doing wrong ? I've successfully used CLASSITEM and EXPRESSION
allready to draw the provinces and territories different colors.
(CLASSITEM "NAME"  , EXPRESSION "Ontario" , EXPRESSION "Quebec" , etc ...)

I tried setting the "annotate" flag, no dice. I tried using a type of
"Polygon" and "Annotation" without success.
The rendering allways takes a while though (i.e. it IS doing something).

I was wondering if the datatype might be a concern (since, as you might
remember, all this configuration information comes from a DB Backend), but
after playing with that, it didn't help. (i.e. 60 or '60' or '[ELEV_RANGE] =
60' , etc ...)

I'm out of ideas ... anyone ?

BTW, Stephen, thanks for thet Proj.pm ... I haven't tried it yet, but I was
looking for such a beast, might want to officially release it someday !

Jean-Francois Doyon
Internet Service Development and Systems Support
GeoAccess Division
Natural Resources Canada
(613) 992-4902



> ----------
> From: 	Stephen Lime[SMTP:steve.lime at dnr.state.mn.us]
> Sent: 	Thursday, June 22, 2000 3:34 PM
> To: 	Jean-Francois.Doyon at CCRS.NRCan.gc.ca;
> mapserver-users at lists.gis.umn.edu
> Subject: 	RE: labelObj in mapscript ?
> 
> This probably has to do with an internal annotation flag that is set when
> the mapfile is read. In cases where the decision to annotate is set after
> the mapfile is loaded then then flag isn't set and annotation won't be
> done.
> This has been remedied in the latest CVS (which I would avoid until
> next Monday unless you're desperate).
> 
> For now there are a couple of workarounds. If you're using a mapfile
> with all layers predefined then you can define a dummy classitem
> property or class text porperty. This is suffiecient to set the annotate
> flag.
> Since your building the entire map from scratch you'll need to set the
> flag 
> by hand for each layer that has annotation. Use something like:
> 
>   $layer->{annotate} = 1;
> 
> and see if that fixes things. Again this has been fixed in the latest
> code.
> 
> Use $class->{label}->{outlinecolor} rather than backgoundcolor. Both
> keywords
> do the samething, but I had to choose one name for the C structures.
> 
> Steve
> 
> Stephen Lime
> Internet Applications Analyst
> 
> Minnesota DNR
> 500 Lafayette Road
> St. Paul, MN 55155
> 651-297-2937
> 
> >>> "Doyon, Jean-Francois" <Jean-Francois.Doyon at CCRS.NRCan.gc.ca> 06/22/00
> 01:56PM >>>
> Thanks a bunch ...
> 
> Now, I'm just stumped ...
> 
> I've setup a system where the mapfile type parameters are now stored in a
> database (At least all the ones that I can).
> 
> So it cycles through the database, determining classes and labels and so
> on
> .. It's been working well so far. I've managed
> to color all canadian provinces and territories using a classitem and an
> expression, and storing all the classes in the DB
> and so on. Now I'm trying to generate an annotation layer that is the city
> names, but I'm having no luck, the labels simply
> won't draw 



More information about the MapServer-users mailing list