Closed Thread Icon

Preserved Topic: Pardon me, Doc Pages that link to <a href="https://ozoneasylum.com/backlink?for=20764" title="Pages that link to Preserved Topic: Pardon me, Doc" rel="nofollow" >Preserved Topic: Pardon me, Doc\

 
Author Thread
linear
Paranoid (IV) Inmate

From: other places
Insane since: Mar 2001

posted posted 05-25-2001 06:05

I would really like to put the Asylum logo on my inmate locator, but I don't want to do it without your express permission. Please drop by and try it out and tell me what you think.

Your pal,
linear

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 05-25-2001 06:17

A submission box might be a neet idea. People can submit their information, you can then review it and post it. Would be the easiest way for you to get the information from them.

linear
Paranoid (IV) Inmate

From: other places
Insane since: Mar 2001

posted posted 05-25-2001 06:33

Yeah, I considered it. I would still have to review it. It's pretty much just as easy to slurp it out of the thread. That way I at least know the inmate has authenticated to the board. If I allow unauthenticated submissions, I get people trying to exile krets to Outer Mongolia.

Not that that's a bad idea....

I really intended to write a PHP script to parse the thread where people submit their locations, then build the included JS file. I wanted to bring this thing to life before people forgot about it, though. With all the bad mojo lately, I really wanted to put out some kind of upper. So I sacrificed some of the automation.

What would really be the bomb would be to extend UBB to accept lat and long as part of the profile for users. Then it would be maintained by the user in the profile area. I could also link in a bunch more shit, like different color asterisks for neurotics/lunatics/maniacs/MadScis, or whatever. I'm not totally unfamiliar with UBB, we run it at work. It's some of the most bletcherous Perl code I've run across. Haven't played with the new version though.

Edit: hey, where the hell are your coordinates? get over there and sign up!


[This message has been edited by linear (edited 05-25-2001).]

DocOzone
Maniac (V) Lord Mad Scientist
Sovereign of all the lands Ozone and just beyond that little green line over there...

From: Stockholm, Sweden
Insane since: Mar 1994

posted posted 05-25-2001 11:33



DocOzone - Stockholm, Sweden - Latitude 18.05 E, Longitude 59.33 N

See also http://www.OzoneAsylum.com/map/images/big_world_flat3.gif - a *very* big map with all cities intact, a bundle at 222k, but worth it IMHO. I have my own prototype running at http://www.OzoneAsylum.com/map/ - How have you figured the latitude distortion for that Gall/Mercator map you have? I'm using the same and am still confused on it. (Another more developed demo is at http://www.JohanNilson.com/test.html - also with broken latitude poop, feh.)

Your pal, -doc-

kretsminky
Maniac (V) Inmate

From: A little lower... lower... ahhhhhh, thats the spot
Insane since: Jun 2000

posted posted 05-25-2001 14:21

Do I really have to tell you my coordinates? I mean, I live right down the street from you silly-willy!


Use that big map! Sweeeeeeet.


Mongolia? Hmmmm. Better get my furs out.

linear
Paranoid (IV) Inmate

From: other places
Insane since: Mar 2001

posted posted 05-25-2001 21:22

Doc,
Unless you're inhabiting a universe orthogonal to this one, latitude is N and longitude is E.

How does it work (linear pulls aside the curtain):

The basic Mercator transformation eq for latitude is :
Northing = A*ln( tan( pi/4 + lat/2) ) (latitude in radians, A is a scale factor)

To plot into a Cartesian coordinate space, you need to define 2 parameters: the vertical extents of the map in degrees, and the width of the map in pixels. Latitude converts to Nothing as described above, and longitude converts ot Easting by a linear (!) scale factor of 2pi. Map height is found by 2*A*ln(tan(pi/4+ maxlat/2)) (where max latitude is the vertical extent of the map, and A is your scale factor).

So now we are scaled to coordinates with the origin at the center. Pixel coordinates have the origin at upper left, and the Y axis inverted. So another scale transformation follows. I whacked together a spreadsheet to help me get the transformations correct before writing the code.

**All that stuff assumes the Earth is spherical. It is, right?

Here are the JavaScript functions that handle the coordinate transformation:

code:
/**** coordinate conversion utilities ****/
function latitude2y(lat, height) {
//** this assumes 75 degree map extents !!
with (Math) {
// convert to radians
var latRadians = lat*PI/180;
// the actual Mercator transformation
// log() is natural log in JS
northing = log(tan((PI/4) + (latRadians/2)));
}
// then scale to our coordinate system
// with the origin in the upper left
// 4.055 is the distance between the 75 degree
// lines, unscaled [2*ln(tan(pi/4 + 75deg/2))]
return( Math.round(height/2 - northing * (height/4.055)) );
}

function longitude2x(longitude, width){
with (Math) {
// convert to radians
var longRadians = longitude*PI/180;
// the actual Mercator transformation
// quite boring for longitude, eh?
easting = longRadians;
}
// then scale to our coordinate system
// with the origin in the upper left
// 6.283 is 2*pi (circumference in radians)
return( Math.round( width/2 + easting * (width/6.283)) );
}



4.055 is a magic constant derived from the fact that the map extents are 75 degrees.

So the rest of the script is pretty simple:
a) set up an array of inmate objects who have lat, long, x, y, email, and url properties
b) iterate over the array and create three DIVs for each inmate
c) position all the DIVS inside that loop
d) handle mouseOver and onClick for the detail DIVs

Creating the DIVs in script is the cool part. It save me from having to code a bunch of stuff. I just add new inmates to the array, and walk away whistling.

I have a 2400 px and 3200 px map also. The way this is coded, I just need to change two definitions at the top of the script and drop in the new gif. Current resuolution of the 1600 px map is 5miles per pixel at the equator.

« BackwardsOnwards »

Show Forum Drop Down Menu