I have imported a shapefile of points into Google Earth Engine but am unable to find information on how to label them by their assigned number in the attribute table. I saw a related thread but the code provided was not successful. This is what I have tried:

// Step 7) Add GRTs points to map
var styling = {color: 'orange', fillColor: '00000000'};
Map.addLayer(HCSR_MgmtGRTs.style(styling), HCSR_MgmtGRTs, "HCSR GRTS");

// Step 8) Label points
var text = require('users/gena/packages:text')
// scale text font relative to the current map scale
var scale = Map.getScale() * 1

var labels = HCSR_MgmtGRTs.map(function(feat) {
  feat = ee.Feature(feat)
  var number = ee.String(feat.get("NUMBER"))
  var centroid = feat.geometry().centroid()
  var t = text.draw(number, centroid, scale, {
    outlineWidth: 1,
    outlineColor: 'orange'
  return t

labels = ee.ImageCollection(labels)

It runs without error, but I am not seeing any labels on my points. I am a beginner, so an easy explanation would be helpful!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.