MapFish provides a MapSearcher class for querying a map. I will use this sample to describe it's usage (source code can be accessed here).
Let's try to see how it works: the information function "i" located in the toolbar lets the user select some features and show them in a grid.
On the server side, it is needed to have an implemation of the MapFish protocol which will interact with the database. See the summits.py code.
On the client side (all the code can be found in search.html) you need:
- to use the MapFish protocol with "protocol = mapfish.Protocol.decorateProtocol({..."
- to create a Map searcher: "var mapSearcher = new mapfish.Searcher.Map({..." which will use the protocol
- to add the "i" button in the toolbar: "toolbar.addControl(mapSearcher, {..."
- to create a grid "new Ext.grid.GridPanel({...", a store "var store = new Ext.data.Store({..." and a store mediator "var searchStoreMediator = new mapfish.widgets.data.SearchStoreMediator({..." to show the result provided by the MapFish protocol in a grid.
4 comments:
Where's the French version ;-) ?
Par ici pour les francophones: http://georezo.net/forum/viewtopic.php?pid=129803#p129803
I want to use the searcher in my client, too.
But I've got one problem:
In this example a protocol is created.
protocol: new mapfish.Protocol.MapFish({
url: mapfish.SERVER_BASE_URL + 'summits',
What kind of URL do I have to add, that the searcher works with my client, too?
This is the URL of the REST protocoll developped on the server side.
Maybe a question send to the mailing list would help you to get a good support.
Post a Comment