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: 

Selecting an Object and Zooming to it

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
165 Views, 2 Replies

Selecting an Object and Zooming to it

I am having problems getting a my application to select an object and then zoom to it.

The idea is the user supplys a desk ID and presses enter and the application selects the Desk and zooms to it.

Does anybody have any example code which does this,

I am pretty new to mapguide and this is all new stuff to me.
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

This is what I did. Just pass the variable desk id to the function along with the layer name that the desk is on.

function zoomTo(layerName, featureKey)
{
var map = getMap();
var sel = map.getSelection();
var feature = map.getMapLayer(layerName).getMapObject(featureKey);
map.setAutoRefresh(false);
sel.clear();
sel.addObject(feature, false);
map.zoomSelected();
lat = map.getLat();
lon = map.getLon();
theScale = map.getScale();

map.zoomScale(lat,lon,theScale)
map.setAutoRefresh(true);
map.refresh();
}


The reason for the zoomScale function towards the end was to zoom out a bit. So you can set theScale = 200 if you want or whatever other value. Hope this helps.

Andrew Malizia
City of Ripon, Ca
Message 3 of 3
Anonymous
in reply to: Anonymous

Hi,

I programmed a Propertypanel wich is displayed in the task pane. If I select a parcel there are pictures and properties displayed in the panel.
Now I try the other way round. The user should be able to search for a parcel by clicking a button. I tried it with your code, I get no error, but nothing is selected either.
The funtions you use ( get map, get Selection, addObject) , where are they definded?

Thanks,

Melanie

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

Post to forums  

Autodesk Design & Make Report