Infrastructure Map Server Forum
Welcome to Autodesk’s Infrastructure Map Server Forums. Share your knowledge, ask questions, and explore popular Infrastructure Map Server topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Which objects do I use for search/query?

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
236 Views, 3 Replies

Which objects do I use for search/query?

Can someone please tell me which objects I'd use from the viewer api
to do a custom search/query a layer, display results, make a selection, and then, zoom to the selection?

Also, i don't get how you would call the viewer api from a new pop-up window (invoke script from the toolbar)

I've been looking at examples and I'm having a really hard time going by whats already out there.

I'D APPRECIATE ANY HELP! THANKS IN ADVANCE!
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

Hi there,

In response to the first question, you don't use the viewer api. It is all done server side through the mapguide api. A feature query typically goes something as follows...

- Initialize the web tier.
- Create an MgFeatureService.
- Get the Feature Source Identifier of the layer you want to query.
- Create an MgFeatureQueryOptions object.
- Set your criteria filters on this object.
- Call MgFeatureService.SelectFeatures() passing the MgFeatureQueryOptions object, the Feature Source Identifier and the class name (table name) of the layer.
- Iterate through the MgFeatureReader that is returned.
- For each result in the MgFeatureReader, write out the properties to your html page.

In response to the second question, the most important thing to note is that all your invoke script commands run from the context of the *viewer frame*.

So when using the viewer api, you have to know where that frame (that contains the method you want to call) is relative to the viewer frame.

- Jackie
Message 3 of 4
Anonymous
in reply to: Anonymous

Thanks for those steps Jackie! I've been able to customize my part of the searchprompt window, and the tricky part I'm facing now is passing the layer and filter values in replacement of the "%s" in the searchprompt.templ file. I'm trying to pass strings that come from the user selecting two combo boxes (layer and filter/attribute filed)...
Message 4 of 4
Anonymous
in reply to: Anonymous

The built-in mapguide search command uses that template file to create the user interface. Modifying it by adding extra fields would probably break any search commands you have already.

I would suggest that you make a copy of that template and modify that instead, then create an "Invoke URL" command to launch it.

- Jackie

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report