<div>Hi </div>
<div> </div>
<div>I am doing this ....</div>
<div> </div>
<div>I have lat/lon of Top Left Corner of the Map and Bottom Right Corner of The Map</div>
<div>iam converting them to projected X,Y using this projection defintion </div>
<div> </div>
<div>World Mercator <54004> +proj=merc +latts=0 +lon0=0 +k=1.000000 +x0=0<br>+y0=0 +ellps=WGS84 +datum=WGS84 +units=m no_defs <></div>
<div> </div>
<div>( I have found on some site that Google Maps use this projection !!)<br> </div>
<div> </div>
<div>For example: </div>
<div> </div>
<div> tl_lat = 42.8483;<br> tl_lon = -74.2935;<br> br_lat = 42.3813; <br> br_lon = -73.6509;<br> </div>
<div> </div>
<div>using pj_transform of proj4.. iam converting them to X,Y.</div>
<div> </div>
<div>
<p>top left xy </p>
<p>-8270314.5893 , 5259843.0071</p>
<p>btm right xy </p>
<p>-8198780.6845 , 5189458.4882<br></p>
<p>I calculate the Centre cX,cY using the top left X,Y and Btm right X,Y...</p>
<p>The Size of the Image I have generated from the Map is (1031,801)...</p>
<p>width = absolute value of (btm right X - top left X)</p>
<p>height = absolute value of (btm right Y - top left Y)</p>
<p>Now I am trying to get the pixel x,y from the projected X,Y using this formula</p>
<p> px = 515.5 + (1031/width)*(X-cX);<br> py = 400.5 - (801/height)*(Y-cY);<br></p>
<p>This gives correct pixels if i give top left or bottom right or the centre X,Y...</p>
<p>But for some point inside the Image ... </p>
<p>the calcualted pixel X is some 2/3 pixels away from actual pixel X </p>
<p>the calcualted pixel Y is some 8/10 pixels away from actual pixel Y</p>
<p>where am I going wrong ... is the projection iam using correct for such calculations ..???</p>
<p> </p>
<p>Thanks in advance.</p>
<p>sandeep</p></div><br><br>
<div><span class="gmail_quote">On 10/6/06, <b class="gmail_sendername">Gerald I. Evenden</b> <<a href="mailto:gerald.evenden@verizon.mail">gerald.evenden@verizon.mail</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">On Friday 06 October 2006 4:38 am, Hugo Tyson wrote:<br>> <a href="mailto:proj-bounces@lists.maptools.org">
proj-bounces@lists.maptools.org</a> <> wrote:<br>> > I want to transform ... this lat/lon 39.739/-104.985...<br>> > to world mercator project ..with the defintition<br>> ><br>> > World Mercator <54004> +proj=merc +latts=0 +lon0=0
<br>> > +k=1.000000 +x0=0 +y0=0 +ellps=WGS84 +datum=WGS84 +units=m no_defs <><br>> ><br>> > but the method gives an "error"....<br>> ><br>> > this method works fine if i give lat/lon say
42.4182,-74.2643<br>><br>> I've not heard of "world mercator", but looking at the parameters<br>> it's projecting into a plane tangent to the sphere at lat 0, lon 0.<br>> So it only works for longitudes from -90 to +90 (though these map
<br>> to infinities in the projected plane).<br>><br>> Your example of -104 longitude is around the back of the earth,<br>> on the "far side" from the projection plane. Therefore a<br>> line from the origin through the point never intersects the
<br>> projection plane, so no result can be calculated. Hence your<br>> error. Lon -74 is in range, so it's OK.<br><br>Excuse me for jumping into the middle of this discussion, but Mercator and<br>normal proj functioning span the range of +-180 degrees longitude. The plane
<br>of the cylindrical projection projection is "unwrapped" from a cut on the<br>projection cylinder opposite the longitude of the central meridian (CM) or<br>180 degrees from the CM. There is no such thing as the '"far side"' of the
<br>projection.<br><br>The following is an example:<br><br>gie@charon:~$ lproj +proj=merc +ellps=WGS84<br>-104.985 39.739<br>-11686876.74 4800765.45<br>-74.2643 42.4182<br>-8267064.06 5195000.64<br>gie@charon:~$<br>
<br>All the other parameters in the original problem are superfluous as they are<br>default values of proj/lproj. The datum option is not part of the proj/lproj<br>system.<br>_______________________________________________
<br>Proj mailing list<br><a href="mailto:Proj@lists.maptools.org">Proj@lists.maptools.org</a><br><a href="http://lists.maptools.org/mailman/listinfo/proj">http://lists.maptools.org/mailman/listinfo/proj</a><br></blockquote>
</div><br><br clear="all"><br>-- <br>Sandeep Kumar Jakkaraju <br>WeBlog:<br><a href="http://jakkarajus.blogspot.com">http://jakkarajus.blogspot.com</a>