Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

106
Vistas
La etiqueta de la capa del punto WFS no se muestra en la capa abierta 3

He cargado los datos de la capa de puntos WFS del geoServer con éxito. Y también puedo trazar la capa de puntos, pero la etiqueta no se mostraba. Agregué una etiqueta como parámetro de texto en la parte Estilo y el parámetro se parece a este text: '${name}',

Actualmente mi código se ve así:

 var sourceWFS = new ol.source.Vector({ format: new ol.format.GeoJSON({ extractGeometryName: true }), title: geoServerLayerName, url: appConfigInfo.wfsurl + '/wfs?service=WFS&version=1.1.0&request=GetFeature&typename=' + geoServerLayerName + '&outputFormat=application/json', strategy: ol.loadingstrategy.bbox, projection: 'EPSG:4326' }); var vectorLayerWFS = new ol.layer.Vector({ source: sourceWFS, style: new ol.style.Style({ image: new ol.style.Icon(({ anchor: [0.5, 1], src: IconUrl })), text: new ol.style.Text({ text: '${name}', font: '12px Calibri,sans-serif', fill: new ol.style.Fill({ color: '#000' }), stroke: new ol.style.Stroke({ color: '#fff', width: 2 }), }) }) }); vectorLayerWFS.setProperties({ title: layerName }); mapObj.addLayer(vectorLayerWFS);
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

El texto debe establecerse en una función de estilo.

 var style = new ol.style.Style({ image: new ol.style.Icon(({ anchor: [0.5, 1], src: IconUrl })), text: new ol.style.Text({ font: '12px Calibri,sans-serif', fill: new ol.style.Fill({ color: '#000' }), stroke: new ol.style.Stroke({ color: '#fff', width: 2 }), }) }); var vectorLayerWFS = new ol.layer.Vector({ source: sourceWFS, style: function(feature) { style.getText().setText(feature.get('name')); return style; } });
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda