thanks , i will get code from QLandkarte :) i will learn a lot from your prog.<br><br>
<div><span class="gmail_quote">2008/4/2, Oliver Eichler <<a href="mailto:oliver.eichler@dspsolutions.de">oliver.eichler@dspsolutions.de</a>>:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi Doğan<br><br>I do the same in QLandkarte GT but I convert the image to a referenced GeoTiff first. By that I can simply read all necessary information from the file instead of calculating it over and over again. That will make the render function more generic. I use GDAL to do so. gdalwarp will skew your image to any projection you want. Most likely you want the image's original projection to avoid heavy distortions. As QLandkarte GT is open source you are welcome to extract any information you need from it's source code. The classes CCreateMapGeoTiff and CMapQMAP will be of interest for you.<br>
<br>HTH<br><br>Oliver<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px; BORDER-LEFT: #ccc 1px solid">
<div><span class="e" id="q_1190dca5f1ef2ad1_1">Hi, I have *.jpg of a map and want to get lat\lon of mouse position on *.jpg.<br>I know the *.jpg file size (ex. 1024x768) and *.jpg lat\lon top_left corner(ex. N2030,320,E01015,400)<br>
and bottom_right corner(ex.N1030,220,E01814,300 )<br>I do this as below code.<br>How to do this with proj4 lib or another more efficient way.<br>(if ı use another *.jpg of map projections different from mercator below code wil be fail.(?) )<br>
<br><br>QString Map::Y2Lat(int Y_size_of_image)//Y_size of jpg ( 768 )<br>{<br><br>//distVincenty(lat1,long1,lat2,long2) returns distance in NM. //here give long same because , want to know *.jpg y size in real.<br>double YRealDist = distVincenty("2030,320","N","01015,400","E", "1030,220","N","01015,400","E");<br>
<br>double YPerPixel=YRealDist/Y_size_of_image;// real distance per pixel of image<br><br>double convfaktor=YPerPixel*currentMousePosY;//real distance from top to current mouse pos.<br><br>//gives destination lat from top_left convfaktor miles with course 180<br>
QString newLatLon = destinationVincenty("2030,320","N","01015,400","E",180.,convfaktor);<br>QString Latitude =toDMS(newLatLon.toDouble(),"NS");<br><br>qDebug()<<"Current mouse position Lat = "<< Latitude ;<br>
return Latitude;<br>}<br><br>QString Map::X2Long(int X_size_of_image)//X_size of jpg ( 1024 )<br>{<br>double top_left_lon = dm2dd("01015,400","E");//long in degree<br><br>double bottom_right_lon = dm2dd("01814,300","E");//long in degree<br>
<br>double XRealDist=(bottom_right_lon-top_left_lon)*60.;//using mercator map 1 degree 60 miles<br><br>double XPerPixel=XRealDist/X_size_of_image;<br><br>double convfaktor=XPerPixel*currentPosX;//top left to mouse pos distance in X<br>
<br>double newLong=top_left_lon + convfaktor/60.;<br><br>QString Long=toDMS(newLong,"EW");<br><br>qDebug()<<"Current mouse position Long = "<< Long ;<br>return Long;<br><br>}<br><br></span></div>
------------------------------------------------------------------------<br><br>_______________________________________________<br>Proj mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:Proj@lists.maptools.org" target="_blank">Proj@lists.maptools.org</a><br>
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.maptools.org/mailman/listinfo/proj" target="_blank">http://lists.maptools.org/mailman/listinfo/proj</a><br></blockquote><br><br>-- <br>------------------------------------------------------------------------<br>
Ingenieure Kellermann, Voigt, Hoepfl, Eichler und Weidner, Partnerschaft<br><br>Email: <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:oliver.eichler@dspsolutions.de" target="_blank">oliver.eichler@dspsolutions.de</a> <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.dspsolutions.de/" target="_blank">http://www.dspsolutions.de</a><br>
Phone: +49(0) 941 / 830 551 Embedded Signal Processing<br>Fax: +49(0) 941 / 830 5579 DIN EN ISO 9001:2000<br><br>Sitz der Partnerschaft ist Regensburg Schwandorfer Str. 3a<br>Registergericht Regensburg: PR14 93059 Regensburg, Germany<br>
------------------------------------------------------------------------<br><br><br>_______________________________________________<br>Proj mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:Proj@lists.maptools.org" target="_blank">Proj@lists.maptools.org</a><br>
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.maptools.org/mailman/listinfo/proj" target="_blank">http://lists.maptools.org/mailman/listinfo/proj</a><br></blockquote></div><br>