Version 2 Window API

I mentioned already about SkyWindow API. Here’s a newer version.
SkyWindow2 API:


Below is the html code that does the trick:


<script type='text/javascript'
   src='http://wikisky.org/js/skywindow2'></script>
<div style='position:relative;left:0px;top:0px;width:450px;height:450px'>
<DIV id='mySkyWnd'
  style='position:absolute;left:0;top:0;width:450px;height:450px;overflow:hidden;border:1px solid gray'
  onmouseout='hideddrivetip();'></DIV></div>
<script type="text/javascript">
var options = {ra:12.4283, de:12.81, initZoom:6, zoom:6,
  survey:"", imgSource:"DSS2", allowTopPanel:true, showTopPanel:true, showRightPanel:false,
  allowMove:true, allowZoom:true,
  showPanZoomControl:true, panZoomControlLeft:6, panZoomControlTop:10,
  showScale:true, showStatus:false, showPosition:true, showStickers:true, showLabels:true,
  jpegQuality:0.8,
  showGrid:true, showOverlayGrid:false,
  showConstLines:true, showOverlayConstLines:false,
  showConstBoundaries:true, showOverlayConstBoundaries:false,
  showConstNames:false, showOverlayConstNames:false,
  showGalaxies:true, showOverlayGalaxies:false,
  showStars:true, showOverlayStars:false,
  buffer:1, moveTime:2000, smoothMoveAccelerationTime:500,
  posColor:"lightgray",posFontSize:"8pt",posFontWeight:"normal",posFontFamily:"verdana",
  scaleMaxLen:90, scaleHeight:6, scaleColor:"lightgray", scaleLineWidth:1
};
new SkyWindow2(options).attach($('mySkyWnd'));
</script>

One important detail: If you want to show object info labels while moving mouse over the map. You need to add simple proxy script on your server to redirect AJAX calls to WikiSky servers. The reason is that browser’s JavaScript security policy does not allow to make AJAX call to any server except the one current page loaded from.

Here’s an example of simple php code:


<?php
include("HttpClient.class.php");
$u=$_SERVER["REQUEST_URI"];
$client = new HttpClient("server1.sky-map.org");
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
   $client->post('/'.$u, file_get_contents("php://input"));
} else {
   $client->get('/'.$u);
}
$contentType = $client->getHeader("Content-Type");
$pageContents = $client->getContent();
header('Content-type: '.$contentType);
echo $pageContents;
?>

8 comments

  1. Nor says:

    I have to admit that this site is terrific!!!

    I’m trying to incorporate your skywindow2 in my web site. I copied the code you provided. The web page works OK in FireFox but the image frame is blank when viewed in IE 8. Are there some options that need to be changed?

    Also AM using ASP on the server. Would you have the comparable VBScript code to allow object labels to be viewed?

    Thanks
    Nor

  2. unumneres says:

    Hey People

    I’m interested to learn [url=http://www.maxkravmaga.com][b]Krav Maga[/b][/url]. I have some MMA experience and I’m wondering if Krav Maga is right for me. I’m looking for a mix of [url=http://www.MaxKravMaga.com][b]Self Defense[/b] and a [url=http://www.MaxKravMaga.com][b]Krav Maga Workout[/b][/url]

    I would appreciate any advice

    regards

    Joe

  3. Dänu says:

    Looks like it needs JQuery, you should mention that ;-)

    $(‘sky_map’) … very jqueryish…

  4. Dänu says:

    Sorry, this is not true, however, if you are using jquery on your webpage, try the following:

    if ($(‘#sky_map’).length > 0) {
    var skymap = new SkyWindow2({ ra: 0, de: 0, zoom: 1,
    survey: “”, imgSource: “DSS2″, allowTopPanel: true, showTopPanel: false, showRightPanel: false,
    allowMove: true, allowZoom: true,
    showPanZoomControl: true, panZoomControlLeft: 6, panZoomControlTop: 10,
    showScale: true, showStatus: true, showPosition: true, showStickers: true, showLabels: false,
    jpegQuality: 0.8,
    showGrid: true, showOverlayGrid: true,
    showConstLines: true, showOverlayConstLines: true,
    showConstBoundaries: true, showOverlayConstBoundaries: true,
    showConstNames: false, showOverlayConstNames: true,
    showGalaxies: true, showOverlayGalaxies: false,
    showStars: true, showOverlayStars: false,
    buffer: 1, moveTime: 2000, smoothMoveAccelerationTime: 500,
    posColor: “lightgray”, posFontSize: “8pt”, posFontWeight: “normal”, posFontFamily: “verdana”,
    scaleMaxLen: 90, scaleHeight: 6, scaleColor: “lightgray”, scaleLineWidth: 1
    });

    skymap.attach($(‘#sky_map’)[0]);
    }

  5. Keep up the good work and post more, I will definitely visit your blog again.

  6. hi!,I really like your writing very so much! share we communicate extra approximately your post on AOL?

    I require an expert in this area to unravel my problem. May be that is you!
    Taking a look forward to peer you.

    Stop by my website Pyjama Bébé

  7. Great info. I enjoyed your article.

  8. Barney says:

    Leah Melby, How to Know if Your Bra Fits, Real – Beauty.
    You will feel far more confident, and enjoy wearing and showing off the new plus size bras.
    This particular style is quite pleasing and appears like the glass is emerging directly from the ground
    and growing naturally.

    Feel free to visit my web-site: breast size (Barney)

Leave a Reply