[OpenLayers-Users] Labelling depending on scale
David Alda Fernandez de Lezea
dalda at hazi.es
Fri Oct 18 01:09:33 PDT 2013
Hi list,
I'm trying to make some rules to label some features depending on the scale. My idea is to do something like
from 1 to 15000 just the symbol
from 15000 to 50000 symbol and label
from 50000 to 1000000 just the symbol
So far my code looks like this:
var pointStyle ={
pointRadius: pto.getGrosor(),
fillOpacity: 1,
strokeOpacity: 1,
strokeColor: "#000000",
strokeWidth: 1,
fillColor: "#" + pto.getColor(),
graphicName: pto.getTipo(),
fontColor: "#" + pto.getLabelColor(),
fontSize: pto.getLabelSize(),
fontWeight: "bold"
};
var pointStyleLabel ={
pointRadius: pto.getGrosor(),
fillOpacity: 1,
strokeOpacity: 1,
strokeColor: "#000000",
label: pto.getLabelText(),
labelAlign: "rt",
strokeWidth: 1,
fillColor: "#" + pto.getColor(),
graphicName: pto.getTipo(),
fontColor: "#" + pto.getLabelColor(),
fontSize: pto.getLabelSize(),
fontWeight: "bold"
};
var feat = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(coords[0],coords[1]));
pila.styleMap.styles["default"].addRules(
new OpenLayers.Rule({
filter: new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.EQUAL_TO,
property: "pila_id",
value: pto.getID()
}),
symbolizer: pointStyle,
maxScaleDenominator: 10000000,
minScaleDenominator: 15000
}),
new OpenLayers.Rule({
filter: new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.EQUAL_TO,
property: "pila_id",
value: pto.getID()
}),
symbolizer: pointStyleLabel,
maxScaleDenominator: 50000,
minScaleDenominator: 15000
}),
new OpenLayers.Rule({
filter: new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.EQUAL_TO,
property: "pila_id",
value: pto.getID()
}),
symbolizer: pointStyle,
maxScaleDenominator: 50000,
minScaleDenominator: 1
})
);
But I don't see the expected result. Anyone could point me out what I'm doing wrong??
Thanks in advance.
David Alda Fernández de Lezea
UNIDAD DE EMPRENDIMIENTO Y DESARROLLO RURAL
Area de Sistemas de Información Geográfica, Planificación Territorial y Forestal
Granja Modelo s/n
01192 Arkaute Araba
T 627923170 F 945 003 290
dalda at hazi.es <blocked::mailto:correo_electronico at hazi.es> | www.hazi.es <blocked::http://www.hazi.es/>
<file://C:\Documents and Settings\u0899dal\Datos de programa\Microsoft\Signatures\HAZI Consultoria_archivos\image001.jpg>
<blocked::http://www.hazi.es/>
********************* LEGE OHARRA ******************* AVISO LEGAL ******************* DISCLAIMER ******************
Mezu hau pertsonala eta isilpekoa da eta baimenik gabeko erabilera debekatua dago legalki. Jasotzailea ez bazara ezabatu mezua, bidali eta kontserbatu gabe.
Este mensaje es personal y confidencial y su uso no autorizado está prohibido legalmente. Si usted no es el destinatario, proceda a borrarlo, sin reenviarlo ni conservarlo.
This message is personal and confidential, unauthorised use is legally prohibited. If you are not the intended recipient, delete it without resending or backing it.
More information about the Users
mailing list