How can I custom geocoder?

i have already written this code but it’s not work :frowning: `OpenStreetMapNominatimGeocoder.prototype.geocode = function (input) {
var endpoint = “https://gis.fimo.com.vn/arcgis/rest/services/vnuhoalac/vnuhoalac_qh878/MapServer/0/query”;
var resource = new Cesium.Resource({
url: endpoint,
queryParameters: {
where: input,
geometryType: “esriGeometryEnvelope”,
spatialRel: “esriSpatialRelIntersects”,
outFields: “*”,
returnGeometry: “true”,
returnTrueCurves: “false”,
returnIdsOnly: “false”,
returnCountOnly: “false”,
returnZ: “false”,
returnM: “false”,
returnDistinctValues: “false”,
resultRecordCount: “1”,
f: “geojson”,
},
});

    return resource.fetchJson().then(function (results) {
      var bboxDegrees;
      return results.map(function (resultObject) {
        bboxDegrees = resultObject.features[0].geometry.coordinates[0][0];
        return {
          displayName: resultObject.objfeatures[0].properties.qh_tenda,
          destination: Cesium.Cartesian3.fromDegrees(
            bboxDegrees[0],
            bboxDegrees[1],
            10000,
          ),
        };
      });
    });
  };

  var viewer = new Cesium.Viewer("cesiumContainer", {
    geocoder: new OpenStreetMapNominatimGeocoder(),
  });

  //Sandcastle_End
  Sandcastle.finishedLoading();
}
if (typeof Cesium !== 'undefined') {
  window.startupCalled = true;
  startup(Cesium);
}`   

Please show me how to fix it?

@yenph

Welcome to the CesiumJS community! We really appreciate that you took the time to share your issue with us :grinning: Can you please share a sandcastle demo that showcases exactly what error you are receiving? This would help me understand the exact issue that you are facing.

-Sam