In this tutorial you will learn how to search your database's documents for geospatial information.
- Install MarkLogic 9 from http://developer.marklogic.com/products.
- Go to https://github.com/marklogicuniversity/geospatial.
- Download the
ML9_Geospatial_Searchworkspace and import it to Query Console. - Follow along with the demo by running the following query tabs:
insert documentscreate geo indexessearch pointssearch regions
- Go to https://github.com/aroach337/ML-region-search.
- Clone the repository to a local directory.
- Navigate to the local directory and run
setup.sh --host=localhostto configure the database and app-servers. - Go to the app-server and change the database to use the Documents Database.
- Open the search.xqy file and change every occurence of
//foo/regionto/location/ctsRegionat line 26 and 28. This way the search will match our Documents database settings and documents’ layout. - (Optionally) Open the index.html and change the initialize function at line 158-162 to change
the
latandlngvalues as well as thezoomfactor so the map shows western Europe. Use these valueslat:45,lng:0,zoom: 5. - Navigate to http://localhost:3333/ (substituting your hostname and port number if needed).
- Draw a rectangle over Europe, select the operator
withinfrom the dropdown and click the search button. - You can draw more shapes or input other coordinate values and test with different operators
- You can load more documents and do more searches.
##Testing and Troubleshooting
If you would like to test the search functionality of the Region Search App before doing any changes directly in the application search.xqy file, simply copy and paste the search.xqy code into a Query Console tab
or use the existing query tab REGION SEARCH APP and test it.