Hi Paul,
Below is a class I wrote for a Java applet a few years ago to convert
lat/lon to x/y coordinates for a map of Iceland. It works from a user
defined center point so it should be pretty easy to manipulate for
use with other areas. Also, if you want to see the class in the full
context of it's original use you can download the whole package at
http://pallit.lhi.is/insideout/TCMIIaO.tar.gz Parts of it are pretty
nasty looking hacks but it works very well.
best r.
Pall Thayer
class parseMe extends ismap {
/* Aside from the URL and background images, the offslat, offslon,
kmbtlat and kmbtlon variables
should be the only things you have to change to make
the map visualize data from a different area than Iceland.
offslat and offslon should represent the center of the
area you wish to show.*/
//offslat and offslon are the center coords for the map
double offslat = 65.15;
double offslon = 18.8533;
/*kmbt = Kilometres between These should be
manipulated to give a flattened representation of
GPS data*/
double kmbtlat = 80;
double kmbtlon = 40;
drawMe myDraw;
public void init() {
setBackground(Color.white);
myDraw = new drawMe();
add(myDraw);
myDraw.init();
}
public void translator(String myCol, String myLat, String myLon) {
/*This is where we take the GPS coords and convert them into plots.
Lots of mysterious hacking going on here. Just play around with the
numbers until it looks right.*/
try{
//using Float.valueOf for MSJVM compatibility
float myLat2 = (Float.valueOf(myLat)).floatValue();
float myLon2 = (Float.valueOf(myLon)).floatValue();
myLat2 = ((float)offslat-myLat2);
myLon2 = ((float)offslon-myLon2);
//System.out.println("***"+myLat2+" "+myLon2);
myLat2 = (myLat2*(float)kmbtlat)*1;
myLon2 = (myLon2*(float)kmbtlon)*1;
float[] coords = {0,0};
coords[0] = myLat2;
coords[1] = myLon2;
//Send the plot data to the myDraw class
myDraw.readCoords(myCol, coords[0], coords[1]);
}catch(Exception e){System.err.println(e);}
}
public void stop() {
}
}
On 31.1.2008, at 21:34, Paul Harwood wrote:
Hi,
Just a lazy question from a novice geowanker I suppose...but it
might save me an evenings surfing though if you can help.
I have googled a bit, with a few solutions... but does anyone have
a perl script (or a site) to hand, to do Lat Long conversions to X
Y? I have UK postcode/outcode/location database that I want to
convert from L Lo to X Y.
I have found this link but don't have enough experience to know
whether its accurate enough, or whether the area I am covering will
have any bearing on it.
http://dan.pfeiffer.net/maps/convert.htm
Many thanks
Paul
_______________________________________________
Geowanking mailing list
[email protected]
http://lists.burri.to/mailman/listinfo/geowanking
--
Pall Thayer
[EMAIL PROTECTED]
http://www.this.is/pallit
_______________________________________________
Geowanking mailing list
[email protected]
http://lists.burri.to/mailman/listinfo/geowanking