Custom GeocoderService to search a LabelCollection

I have a collection of labels. I would like to be able for the user to search them using a custom GeocoderService. Has anyone already written this by chance so I don't have to reinvent the wheel? Thanks! Eric

I did it -- it's ugly but it seems to work ok :slight_smile:

I'm new to Cesium and js so there are some things that I'm not sure about, if anyone would like to help clean it up that would be great!

1) I faked a Cesium.loadText promise because I don't know how to make my own
2) It could use an exact calculation of bounding box size based on height
3) What's the proper way to deal with meridian/pole boundaries when using the globe?



* This class is an example of a custom geocoder. It provides geocoding by searching inside a LabelCollection.
* @alias LabelCollectionGeocoder
* @constructor

function LabelCollectionGeocoder() {

* The function called to geocode using this geocoder service.

this version searches through all of the available LabelCollections

wrong link

This code is very interesting and almost does what I would like to do. What should I change to your code in order to display also a point to each of the labels you have created?


Thank you for sharing this. Your example has helped me to achieve custom geocoder that searches adresses from geojson file.

It works perfect but I don't understand completely every variable you used.
What are horizdeg, n/s latitude, n/s longitude, max/min heights etc?
I would be very thankful if you could comment these lines of code.
Anyways, I appreciate your help.


I have tried the above code on the given link. But its not working. When i typed a string "SAR for example" it just gives the string "Seraching.." in the search box. I tried to debug the same code on my local. The code never hits the return part. I like to use the same functionality but its not working. Please advice.
what i want to achieve is a user inputs a label in the search and the camera flies to the position.

Thanks in advance. :slight_smile:

I think the geocoder might have changed slightly since that post. We recently added support for a new open source geocoder:

And you can see the pull request here:

So that might be a good reference to see how you can build your own.