[mapserver-users] Label size proportion to geometry size
Steve Grey
stevegrey78 at gmail.com
Wed Apr 14 04:24:49 PDT 2010
Jackey,
There certainly would be more to manage with separate classes/layers for
different scales, however a function could instead return the raw source
data, with additional appended column(s) for text size/max size etc.
calculated by the function and based on the supplied scale.
Also, the function doesn't need to be written for every layer - if you pass
the name of the layer as an argument to the function call, the function
could construct and execute the SQL to return complete records for the
supplied area and supplied layer, with additional calculated columns for the
text size.
In this case you'd always be returning a set of RECORD values, and the
downside is PostgreSQL has to match the returned RECORD to a list of columns
you define as part of the select - along the lines of "select * from
myfunction() as mytypedef(val1 int,val2 varchar)", and with a wide table
this could make for wordy SQL.
The speed shouldn't be noticeably affected - the data source would be
selected by spatial selection on a data source, and a few operations to
calculate a scale shouldn't cost too much.
Might I ask for you to also post replies back to the group?
Thanks,
Steve
On 14 April 2010 06:35, Jackey Cheung <cheung.jackey at gmail.com> wrote:
> Steve,
>
> I think this is a possible solution. However, it'll involve much extra
> effort to implement, and the whole process will get complicated. To make it
> that way, we have to setup separate classes/layers for different scales, and
> then pass the scale as parameter to the database. As the map grows bigger,
> and more and more layers are added to it, people will get confused and lost.
> And I think, it'll be impact to map rendering too.
>
>
>
> On Tue, Apr 13, 2010 at 7:07 PM, Steve Grey <stevegrey78 at gmail.com> wrote:
>
>> Jackey,
>>
>> If it can't be achieved in Map Server settings, it might be possible to
>> accomplish if your data is in PostGIS and you can get your data from a
>> database function rather than a table/view as your data source. In that
>> case, and if appropriate arguments can be sent to a PostGIS function, the
>> dynamic part can be taken care of as part of the select. You'll then have
>> to optimise the speed/structure in the PostGIS side.
>>
>> I have no idea if this might work!
>>
>> Steve
>>
>>
>>
>> On 13 April 2010 09:45, Jackey Cheung <cheung.jackey at gmail.com> wrote:
>>
>>> Hi all,
>>>
>>> Say, I have two polygon in the same layer, and they are at the same
>>> logical group/level on the map. Means that both feature should be drawn and
>>> labeled at the same scale. However, one polygon is much larger than (say 10
>>> times larger) than the other. Currently, I let MapServer to handle the
>>> scaling automatically, so that in a display scale, the label of the larger
>>> one looks too small while the larger one looks gigantic.
>>>
>>> My thought is straight forward: tie the font size to the size of the
>>> polygon. However, since the label must be scaled with respect to the map
>>> display scale, it has to be dynamic; further, since they belongs to the same
>>> logical group, they'll eventually be in the same size when zoomed in enough.
>>> My first thought is to bind the MINSIZE to a data attribute, so that they
>>> start with different font sizes and eventually scaled to the same MAXSIZE.
>>> But the MINSIZE/MAXSIZE cannot be used in this way.
>>>
>>> Any suggestions?
>>>
>>> P.S. I'm not using mapscript, just map file.
>>>
>>> _______________________________________________
>>> mapserver-users mailing list
>>> mapserver-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20100414/e6daa2aa/attachment.htm>
More information about the MapServer-users
mailing list