Well, As i sad before:<BR> <BR> I am not having problems with theory about projections (I have some <BR>experience in cartography...and I understand what is a projection), I am <BR>having problems with CODING, here I am NEW. I just wanted to see some <BR>examples, but I will find the solution<BR> <BR> Thank you for your time<BR><BR><BR><B><I>Puneet Kishor <punkish@eidesis.org></I></B> wrote: <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"><BR>On Feb 9, 2006, at 7:57 AM, william paul wrote:<BR><BR>> I replay to the email, I didn't thing that the list will not receive <BR>> the email!!!<BR>> <BR>> My problem isn't how you transform from DD to DMS. I already know this.<BR>> <BR>> I want to make the transformation in such manner that the DMS are <BR>> displayed ON MOUSEMOVE over the map, which means that the coordinates <BR>> are changing with position of
the cursor on the map<BR>> <BR>> I did that for DD using a script found on the list, but I can't make <BR>> it work for DMS<BR>> <BR>> My code looks like:<BR>> <BR>> var x2 = event.offsetX; // mouse coordinates in pixels<BR>> var y2 = event.offsetY; // mouse coordinates in pixels<BR>> var res_dd = ([maxlon] - [minlon]) / [mapwidth]; // resolution in DD<BR>> var x_dd = [minlon];<BR>> var y_dd = [minlat];<BR>> x1_dd = Math.round(((x2*res_dd) + x_dd)*1000000)/1000000; <BR>> //coordinates in DD to be displayed on mousemove<BR>> y1_dd = Math.round(((([mapheight] - y2)*res_dd) + <BR>> y_dd)*1000000)/1000000; //coordinates in DD to be displayed on <BR>> mousemove<BR>><BR>> window.status="Latitude DD: " + y1_dd + " " + "Longitude DD: " + y1_dd;<BR>> <BR>> I tried for DMS:<BR>> <BR>> //for longitude in DMS<BR>><BR>> var dd = Math.floor(x1_dd);<BR>> var m = Math.floor((x1_dd - dd) *
60);<BR>> var s = Math.ceil((((x1_dd - dd) * 60) - m) *60);<BR>> <BR>> I also have tried to break the resolution in DMS, but I don't know how <BR>> to multiply the resolution with the coordinates in pixel and then add <BR>> to minlon<BR><BR><BR>I am not sure what the problem is. Do for DMS exactly the way you are <BR>doing for DD. There is nothing conceptually different between DD and <BR>DMS. They express the same thing in different ways -- it is like saying <BR>1 lb of tomatoes versus 454 gms of tomatoes. Figure out your min, max <BR>in DMS, and add them to your current mouse coordinates.<BR><BR>That said, look at Clint Johnson's email from yesterday. He recommends <BR>reading about projections at <BR>http://fisher.lib.virginia.edu/reference/help/esri/esri_pdfs_9.html, <BR>and that should be the first thing that all MapServer users should read <BR>before setting out making mapping websites. Ed McNierny also has <BR>elaborated on this several times (in fact, I
have been thinking of <BR>taking all of Ed's emails and compiling them into a "must read"... note <BR>to Ed -- if you save your MapServer-list emails, forward them to me and <BR>I will do the rest).<BR><BR>Remember, that the pixel space is a rectangle, in that, opposite sides <BR>are equal, while Lat/Long space is more like a trapezoid, in that, the <BR>horizontal opposite sides are not equal, and in fact, at the poles, it <BR>becomes a triangle. If you really want to be exact with your coordinate <BR>display, project your map into a rectangular coordinate system and then <BR>you will get what you want.<BR><BR><BR>> <BR>> william paul wrote:<BR>> > Hi:<BR>> ><BR>> > I know this, my problem is other, but...I will solve it<BR>><BR>> Please send all replies to the list as well. In the meantime, would<BR>> the following help --<BR>><BR>> //(0) Grab the dd value<BR>> var dd = obj.value;<BR>><BR>> // (1) The Degrees are simply the
numbers to the left of the decimal<BR>> // (using 42.36824 as an example, the degrees would be 42)<BR>> var d = Math.floor(dd);<BR>><BR>> // (2) To determine the Minutes, multiply the number to the right of<BR>> // the decimal point by 60 (example: .36824 x 60 = 22.0944)<BR>> // (3) The Minutes are the numbers to the left of the decimal point<BR>> // (in this example, 22)<BR>> var m = Math.floor((dd - d) * 60);<BR>><BR>> // (4) To determine the Seconds, multiply the number to the right of<BR>> // the decimal point by 60 (example: .0944 x 60 = 5.664)<BR>> // (5) The Seconds are the numbers to the left of the decimal point,<BR>> // rounded up (in this example, 06)<BR>> var s = Math.ceil((((dd - d) * 60) - m) * 60);<BR>><BR>> // display it<BR>> var dms = d + ' deg, ' + m + ' min, ' + s + ' sec';<BR>><BR>> ><BR>> > */Puneet Kishor <PUNKISH@EIDESIS.ORG>/* wrote:<BR>> ><BR>> > william
paul wrote:<BR>> > > Hi:<BR>> > ><BR>> > > I display the coordinates on mousemove over the map. The<BR>> > coordinates are<BR>> > > in DD and UTM, but I would like display them also in DMS.<BR>> > ><BR>> ><BR>> > From the very first hit on Google --<BR>> ><BR>> > (1) The Degrees are simply the numbers to the left of the decimal<BR>> > (using 42.36824 as an example, the degrees would be 42)<BR>> > (2) To determine the Minutes, multiply the number to the right <BR>> of<BR>> > the decimal point by 60 (example: .36824 x 60 = 22.0944)<BR>> > (3) The Minutes are the
numbers to the left of the decimal point<BR>> > (in this example, 22)<BR>> > (4) To determine the Seconds, multiply the number to the right of<BR>> > the decimal point by 60 (example: .0944 x 60 = 5.664)<BR>> > (5) The Seconds are the numbers to the left of the decimal point,<BR>> > rounded up (in this example, 06)<BR>> ><BR>> > Implementing it in Js is left as an exercise for the reader...<BR>> ><BR>> ><BR>><BR>><BR>> --<BR>> Puneet Kishor<BR>><BR>> __________________________________________________<BR>> Do You Yahoo!?<BR>> Tired of spam? Yahoo! Mail has the best spam protection around<BR>> http://mail.yahoo.com<BR>--<BR>Puneet Kishor<BR><BR></BLOCKQUOTE><BR><p>
<hr size=1> <a href="http://us.rd.yahoo.com/mail_us/taglines/virusmail/*http://mail.yahoo.com">Yahoo! Mail</a> - Helps protect you from nasty viruses.