How can I custom geocoder?

i have already written this code but it’s not work :frowning: `OpenStreetMapNominatimGeocoder.prototype.geocode = function (input) {
var endpoint = “”;
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 (resultObject) {
        bboxDegrees = resultObject.features[0].geometry.coordinates[0][0];
        return {
          displayName: resultObject.objfeatures[0].properties.qh_tenda,
          destination: Cesium.Cartesian3.fromDegrees(

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

if (typeof Cesium !== 'undefined') {
  window.startupCalled = true;

Please show me how to fix it?


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.