[Proj] pj_transform function

Sandeep Kumar Jakkaraju sandeepkumar.jakkaraju at gmail.com
Fri Oct 6 05:58:49 EDT 2006


Hi Huge

Thanx again for your reply.

How will I know which projection to use for say Albany,NY when I want to
project my shapefile which is unprojected in lat/lon to some projection like
Mercator or anything else ?

I am trying to convert the geographical co-ordinates to screen co-ordinates
..
so i require to convert the lat/lon to some projection and then convert that
X,Y to pixels...
(hope this is correct ...!!)

I am using projected co-ordiantes of Albany using the projection definition

World Mercator <54004> +proj=merc +latts=0 +lon0=0
+k=1.000000 +x0=0 +y0=0 +ellps=WGS84 +datum=WGS84 +units=m no_defs

but when i convert this projected X,Y in pixels
there is error of 2/3 pixels in X and 8/10 pixels in Y.
so this is not the right projection ....

It would be great if you could help me with this ...

Thanks

Sandeep
Senior Software Engineer
ACL-Wireless
Noida, India.





On 10/6/06, Hugo Tyson <Hugo.Tyson at cpslocates.com> wrote:
>
> Sandeep Kumar Jakkaraju [sandeepkumar.jakkaraju at gmail.com] wrote:
> > So what should be the  projection definition then .. to make
> > it general..???
> >
> > I am trying to convert the geographical co-ordinates to
> > screen co-ordinates ..
> > so i require to convert the lat/lon to some projection and
> > the convert that X,Y to pixels...
> > hope this is correct ...
>
> Ah.  So you just want like a map of the whole world, as
> a rectangle, sort of thing?  That's not a "projection"
> in the proj4 sense, as I understand it.
>
> How about
>        double x = (lon + 180.0)/360.0 * pixelswidth;
>        double y = (lat +  90.0)/180.0 * pixelsheight;
> of course that'll be ugly at far north and south,
> but at least it maps the whole space.
>
> > or is there some function in proj4/or anywhere else which
> > does this ....??
>
> I don't think this is the sort of thing that proj is for.
>
> Alternatively if you're mapping a small areas of the world
> into one page or bitmap, you need to pick a proj4 projection
> that works for that small area.
>
>        - Huge
>
> PS I was mistaken in what I wrote before, mercator maps to a
> half-cylinder wrapped around the globe.  Your example touches
> at long 0.0, so it's still true that your long -104 is "around
> the back".
>
>
> > On 10/6/06, Hugo Tyson <Hugo.Tyson at cpslocates.com> wrote:
> >
> >       proj-bounces at lists.maptools.org <> wrote:
> >       > I want to transform ... this lat/lon 39.739/-104.985...
> >       > to world mercator project ..with the defintition      >
> >       > World Mercator <54004> +proj=merc +latts=0 +lon0=0
> >       > +k=1.000000 +x0=0 +y0=0 +ellps=WGS84 +datum=WGS84 +units=m
> no_defs
> >       <> >
> >       > but the method gives an "error"....
> >       >
> >       > this method works fine if i give lat/lon say 42.4182,-74.2643
> >
> >       I've not heard of "world mercator", but looking at the parameters
> >       it's projecting into a plane tangent to the sphere at
> > lat 0, lon 0.
> >       So it only works for longitudes from -90 to +90 (though
> > these map
> >       to infinities in the projected plane).
> >
> >       Your example of -104 longitude is around the back of the earth,
> >       on the "far side" from the projection plane.   Therefore a
> >       line from the origin through the point never intersects the
> >       projection plane, so no result can be calculated.  Hence your
> >       error.  Lon -74 is in range, so it's OK.
>
> --
> Hugo Tyson, Cambridge Positioning Systems Ltd
> =************************************************************
>
> ********************************************************************************
> This email and any attachments are confidential. They have been checked
> for viruses but it is your
> responsibility to conduct your own virus checks.
> Cambridge Positioning Systems Limited, 62-64 Hills Road, Cambridge, CB2
> 1LA, is registered in England
> under company number 2808344.
>
> ********************************************************************************
>
>
> _______________________________________________
> Proj mailing list
> Proj at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/proj
>



-- 
Sandeep Kumar Jakkaraju
WeBlog:
http://jakkarajus.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/proj/attachments/20061006/47edac85/attachment-0001.html


More information about the Proj mailing list