Google Earth Enterprise Documentation Home | GEE Server administration
Add custom search services
If you want to access a custom data source, you can create your own search plug-in and access it as a search tab definition in Google Earth Enterprise Server. A custom search plug-in will create requests and responses using the common Python-based search framework, letting you adapt your search to any data source. Your custom search plug-in will receive search requests directly from Google Earth Enterprise Client (EC), or any other clients in the form of URL parameters.
For example, with custom search plug-ins you can use Maps API and Places API to leverage the power of their data sets. You can also use a proprietary database, for example, power conversion sites, then search for the sites using internal IDs or city names.
A custom search plug-in may also provide a solution if you want to search data that is not on your Google Earth Enterprise Server or you want to combine Google Earth Enterprise databases in new ways. For example, you may want to combine a Places search with your own vector point data set, enabling your users to search by city name or the name of your facilities. Your custom search plug-in would forward your request to both the POI Search plug-in and the Places plug-in and return a merged set.
Note: Google Maps API and Places API access services over the internet, and require licenses to use.
Note: You will need some familiarity with Python to work with custom search plug-ins.
- Configure search queries for Google Earth EC and Google Maps
- Access Search Plug-ins
- Implement your custom search plug-in
Any web service, servlet, or web application you configure the search tabs to query:
- Must return valid KML to Google Earth EC.
- Must return valid JSONP in the specified structure.
Because search tabs are returned as JSONP, they must originate from the same server as the HTML page containing the 2D map.
The Google Earth Enterprise search plug-ins are stored in a default directory that you can use to add or delete your custom plug-ins as required. You can also modify the configuration file,
/opt/google/gehttpd/conf.d/mod_wsgi-ge.conf, to register new search plug-ins with Google Earth Enterprise Server instead of creating search tabs. The configuration file provides a convenient method for managing search plug-ins with scripts, for example, to register newly created plug-in endpoints so that they can be accessible when you view your database in Google Earth EC.
You can access the plug-ins that are installed with Google Earth Enterprise Server at:
For example, access
/gesearch/ExampleSearch in your browser as follows:
The plug-in end points are for Google Earth Enterprise search plug-ins are defined in
# Handles Places search requests. WSGIScriptAlias /gesearch/PlacesSearch /opt/google/gehttpd/wsgi-bin/search/plugin/geplaces_search_app.py # Handles Coordinate search requests. WSGIScriptAlias /gesearch/CoordinateSearch /opt/google/gehttpd/wsgi-bin/search/plugin/coordinate_search_app.py # Handles Federated search requests. WSGIScriptAlias /gesearch/FederatedSearch /opt/google/gehttpd/wsgi-bin/search/plugin/federated_search_app.py # Handles Example search requests. WSGIScriptAlias /gesearch/ExampleSearch /opt/google/gehttpd/wsgi-bin/search/plugin/example_search_app.py # Handles POI search requests. WSGIScriptAlias /POISearch /opt/google/gehttpd/wsgi-bin/search/plugin/poi_search_app.py
You implement your custom search plug-in by creating your own python search application using WSGI, then you register your new search plug-in so that it can be added as you publish databases.
To implement your custom search plug-in:
- Create your search application, using the WSGI framework. See the ExampleSearch Python module for example code.
- Locate your search plug-in, for example
custom_search.py, in the
- Register your plug-in by adding its definition in the python module configuration file:
/opt/google/gehttpd/conf.d/mod_wsgi-ge.conf. Your registration in the configuration file should look something like the following:
# Handles My Custom search requests.
WSGIScriptAlias /gesearch/CustomSearch /opt/google/gehttpd/wsgi-bin/search/plugin/mycustom_search_app.py
- Restart Google Earth Enterprise Server:
# sudo /etc/init.d/geserver restart
- Open the Google Earth Enterprise Server Admin console and click Search tabs. The list of Search tabs definitions appears.
- Click Create New to create a new search definition.
- Add a name and label.
- In the URL field, add the
WSGIScriptAliasthat you specified in the
/opt/google/gehttpd/conf.d/mod_wsgi-ge.conffile. In this example, you would enter
If you want to add query parameters that are hidden from Google Earth EC, such as the way the results will be sorted or the number of results displayed at a time, enter them in the Additional Query Parameters field. The syntax is key1=value1&key2;=value2. For example, sortby=name&numresults;=10 sorts by the name field and displays 10 results at a time. Your search application must be able to understand and respond to these key/value pairs, so you must be very familiar with your search application to use this field.
- Set the fields, and other options as needed and click Save. Your new custom search definition is added to the list on the Search tabs page.
- When you publish a database, add your search definition from the Search tabs drop-down list in the Publish dialog.