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: 

building an overview map

8 REPLIES 8
Reply
Message 1 of 9
chinedu
300 Views, 8 Replies

building an overview map

hi all,
I was browsing this forum looking for a sample of how to build an overview map.

I found the code below but I have a little problem with the
getViewPane() function. Has anyone used this code or something similar?

Here is the code:

function onViewChanged()
{
////////////////////////
// get access to maps //
////////////////////////
var map = getMap();
var viewpane = getViewpane();
/////////////////////////////////////////////////
// Get the longitude (x) and latitude (y) //
// of the centerpoint of the current mapwindow //
/////////////////////////////////////////////////
var myCenterLat = map.getLat()
var myCenterLon = map.getLon()
//////////////////////////////////////////////////
// Compute/Convert centerpoint of the current //
// mapwindow in Mapping Coordinate System (MCS) //
//////////////////////////////////////////////////
var myMCSCenterPoint = map.lonLatToMcs(myCenterLon, myCenterLat);
/////////////////////////////////////////////////////////////
// Get the scalefactor to convert from Meters to MCS units //
/////////////////////////////////////////////////////////////
var myMCSScaleFactor = map.getMCSScaleFactor();
////////////////////////////////////////////////////
// Get current halfWidth and halfHeight in meters //
////////////////////////////////////////////////////
var myHalfMapHeight = map.getHeight("M")/2;
var myHalfMapWidth = map.getWidth("M")/2;

/////////////////////////////////////////////////// /////////////////////////
/
// Compute Maximum and Minimum Coordinates of the current mapwindow in MCS
//

////////////////////////////////////////////////////////////// //////////////
/
var myMCSMaxY = myMCSCenterPoint.getY() +
(myHalfMapHeight*(1/myMCSScaleFactor));
var myMCSMaxX = myMCSCenterPoint.getX() +
(myHalfMapWidth*(1/myMCSScaleFactor));
var myMCSMinY = myMCSCenterPoint.getY() -
(myHalfMapHeight*(1/myMCSScaleFactor));
var myMCSMinX = myMCSCenterPoint.getX() -
(myHalfMapWidth*(1/myMCSScaleFactor));
////////////////////////////////////////////////
// Compute/Convert Maximum and Minimum Points //
// of the current mapwindow in LatLon (LL) //
////////////////////////////////////////////////
var myLLMaxXMaxYPoint = map.mcsToLonLat(myMCSMaxX, myMCSMaxY);
var myLLMinXMaxYPoint = map.mcsToLonLat(myMCSMinX, myMCSMaxY);
var myLLMinXMinYPoint = map.mcsToLonLat(myMCSMinX, myMCSMinY);
var myLLMaxXMinYPoint = map.mcsToLonLat(myMCSMaxX, myMCSMinY);
////////////////////////////////
// Add points to a collection //
////////////////////////////////
var points = map.createObject("mgcollection");
points.add(myLLMaxXMaxYPoint);
points.add(myLLMinXMaxYPoint);
points.add(myLLMinXMinYPoint);
points.add(myLLMaxXMinYPoint);
points.add(myLLMaxXMaxYPoint);
var user_vertices = map.createObject("mgcollection");
user_vertices.add(5);
//
// change redline setup //
//
var redline_setup = viewpane.getRedlineSetup();
// get edge attribute
var edge_attr = redline_setup.getEdgeAttr();
// make edge red
edge_attr.setColor(5);
edge_attr.setThickness(4);
//
// disable autorefresh
//
viewpane.setAutoRefresh(false);
//
// create redline layer, or get it if it already exists
//
var myLayer = viewpane.getMapLayer("viewPane");
if (myLayer == null)
{
myLayer = viewpane.createLayer("redline", "viewPane");
myLayer.setShowInLegend(false);
}
// create redline object, or get it if it already exists
var obj = myLayer.getMapObject('viewPane');
if (obj != null)
{
// remove object if it already exists
myLayer.removeObject(obj);
}
// add a new object to the layer
obj = myLayer.createMapObject('viewPane', 'viewPane', '');
// use MGCollection to create polygon primitive and add it to redline
object
obj.addPolygonPrimitive(points, user_vertices, false);
//
//
// enable autorefresh
//
viewpane.setAutoRefresh(true);
viewpane.refresh();
}

Below is the part of the code I need to grab:

// get access to maps //
////////////////////////
var viewpane = getViewpane();


Thanks much in advance
8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: chinedu

You can also download the GEOMAP publishing wizard from
http://www.geomapgis.ca//website/en/webRedir.asp?addr=products/geomap/ggPubWiz.htm,
run it while choosing to have it build an overview (or locator map, I can't
remember what they call it). Then you can grab the code out of there and
use it in your own application.


--
Andy Morsell, P.E.
Spatial Integrators, Inc.
http://www.SpatialGIS.com


wrote in message news:5193296@discussion.autodesk.com...
hi all,
I was browsing this forum looking for a sample of how to build an overview
map.

I found the code below but I have a little problem with the
getViewPane() function. Has anyone used this code or something similar?

Here is the code:

function onViewChanged()
{
////////////////////////
// get access to maps //
////////////////////////
var map = getMap();
var viewpane = getViewpane();
/////////////////////////////////////////////////
// Get the longitude (x) and latitude (y) //
// of the centerpoint of the current mapwindow //
/////////////////////////////////////////////////
var myCenterLat = map.getLat()
var myCenterLon = map.getLon()
//////////////////////////////////////////////////
// Compute/Convert centerpoint of the current //
// mapwindow in Mapping Coordinate System (MCS) //
//////////////////////////////////////////////////
var myMCSCenterPoint = map.lonLatToMcs(myCenterLon, myCenterLat);
/////////////////////////////////////////////////////////////
// Get the scalefactor to convert from Meters to MCS units //
/////////////////////////////////////////////////////////////
var myMCSScaleFactor = map.getMCSScaleFactor();
////////////////////////////////////////////////////
// Get current halfWidth and halfHeight in meters //
////////////////////////////////////////////////////
var myHalfMapHeight = map.getHeight("M")/2;
var myHalfMapWidth = map.getWidth("M")/2;

///////////////////////////////////////////////////
/////////////////////////
/
// Compute Maximum and Minimum Coordinates of the current mapwindow in MCS
//

//////////////////////////////////////////////////////////////
//////////////
/
var myMCSMaxY = myMCSCenterPoint.getY() +
(myHalfMapHeight*(1/myMCSScaleFactor));
var myMCSMaxX = myMCSCenterPoint.getX() +
(myHalfMapWidth*(1/myMCSScaleFactor));
var myMCSMinY = myMCSCenterPoint.getY() -
(myHalfMapHeight*(1/myMCSScaleFactor));
var myMCSMinX = myMCSCenterPoint.getX() -
(myHalfMapWidth*(1/myMCSScaleFactor));
////////////////////////////////////////////////
// Compute/Convert Maximum and Minimum Points //
// of the current mapwindow in LatLon (LL) //
////////////////////////////////////////////////
var myLLMaxXMaxYPoint = map.mcsToLonLat(myMCSMaxX, myMCSMaxY);
var myLLMinXMaxYPoint = map.mcsToLonLat(myMCSMinX, myMCSMaxY);
var myLLMinXMinYPoint = map.mcsToLonLat(myMCSMinX, myMCSMinY);
var myLLMaxXMinYPoint = map.mcsToLonLat(myMCSMaxX, myMCSMinY);
////////////////////////////////
// Add points to a collection //
////////////////////////////////
var points = map.createObject("mgcollection");
points.add(myLLMaxXMaxYPoint);
points.add(myLLMinXMaxYPoint);
points.add(myLLMinXMinYPoint);
points.add(myLLMaxXMinYPoint);
points.add(myLLMaxXMaxYPoint);
var user_vertices = map.createObject("mgcollection");
user_vertices.add(5);
//
// change redline setup //
//
var redline_setup = viewpane.getRedlineSetup();
// get edge attribute
var edge_attr = redline_setup.getEdgeAttr();
// make edge red
edge_attr.setColor(5);
edge_attr.setThickness(4);
//
// disable autorefresh
//
viewpane.setAutoRefresh(false);
//
// create redline layer, or get it if it already exists
//
var myLayer = viewpane.getMapLayer("viewPane");
if (myLayer == null)
{
myLayer = viewpane.createLayer("redline", "viewPane");
myLayer.setShowInLegend(false);
}
// create redline object, or get it if it already exists
var obj = myLayer.getMapObject('viewPane');
if (obj != null)
{
// remove object if it already exists
myLayer.removeObject(obj);
}
// add a new object to the layer
obj = myLayer.createMapObject('viewPane', 'viewPane', '');
// use MGCollection to create polygon primitive and add it to redline
object
obj.addPolygonPrimitive(points, user_vertices, false);
//
//
// enable autorefresh
//
viewpane.setAutoRefresh(true);
viewpane.refresh();
}

Below is the part of the code I need to grab:

// get access to maps //
////////////////////////
var viewpane = getViewpane();


Thanks much in advance
Message 3 of 9
Anonymous
in reply to: chinedu



getViewPane() is the equivalent of getMap and refers to the map in the
viewpane frame

getMap() gives you a handle to the main map
getViewPane() gives you a handle to the overview map

Code below is way old, so IE and Netscape(!) browsers only.

HTH Johan

////////////////////////
// get access to maps //
////////////////////////
function getMap()
{
/////////////////////////////
// access the map (master) //
/////////////////////////////
if(navigator.appName == "Netscape")
{
return parent.mapframe.document.map;
}
else if(navigator.appName == "Microsoft Internet Explorer")
{
return parent.mapframe.map;
}
else // other browser, ough
{
return alert('Sorry, only works for Netscape or Microsoft Internet
Explorer');
}
}
function getViewpane()
{
////////////////////////////
// access the map (slave) //
////////////////////////////
if(navigator.appName == "Netscape")
{
return parent.viewpane.document.map;
}
else if(navigator.appName == "Microsoft Internet Explorer")
{
return parent.viewpane.map;
}
else // other browser, ough
{
return alert('Sorry, only works for Netscape or Microsoft Internet
Explorer');
}
}
Message 4 of 9
chinedu
in reply to: chinedu

Thanks Andy,

I get the impression that the wizard contains basic features because I didn't see any of the locator / overview map scripts after the wizard was downloaded and installed.
Message 5 of 9
chinedu
in reply to: chinedu

Johan, thanks for the response.

Looking at the getViewPane() function, I get the impression that a frame called viewpane needs to be added to my current frameset, right?

I can't seem to get it to work. Do you invoke my calling onViewChanged() or getViewPane()?

Is there any way I can view a "live" version of this online?

Will I be asking for too much if I ask you to send the "working" version of your script?

Hope to hear from you. thanks
Message 6 of 9
Anonymous
in reply to: chinedu

Chinedu,

>I get the impression that a frame called viewpane needs to be added to my
>current frameset, right?
Yup

>I can't seem to get it to work. Do you invoke my calling onViewChanged() or
>getViewPane()?
Most of this is done by using the onViewChanged event.

>Is there any way I can view a "live" version of this online?
Nope

> Will I be asking for too much if I ask you to send the "working" version
> of your script?
Drop me an e-mail and I'll mail the "working" version to you.

CU Johan
Message 7 of 9
Anonymous
in reply to: chinedu

chinedu wrote:
> Is there any way I can view a "live" version of this online?

Our Habitat Atlas site has an "overview" map:
http://enviro.nanaimo.ca/index.cfm?tab_ID=3&content_ID=7

(only in the IE version)

Jason
Message 8 of 9
chinedu
in reply to: chinedu

Oh, you are so kind, thank you very much.

I don't know your email address.

However, here is mine:

ciss at bellsouth dot net

You are sooo kind, thank you very much
Message 9 of 9
Anonymous
in reply to: chinedu

You may have to download the wizard templates that contain the locator map
capability from the same URL I provided earlier. It looks like they call
that feature the "minimap". the best way to get the code is to build a
dummy site in some folder and then you can tear it apart from there.

Andy

wrote in message news:5193602@discussion.autodesk.com...
Thanks Andy,

I get the impression that the wizard contains basic features because I
didn't see any of the locator / overview map scripts after the wizard was
downloaded and installed.

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

Post to forums  

Autodesk Design & Make Report