Perl mapscript reprojecting WKT issues

Kralidis,Tom [Burlington] Tom.Kralidis at EC.GC.CA
Tue May 29 16:32:59 PDT 2007


Tamas,

Thanks for the info.  Trying this via python yields the same results as
Perl:

import sys, mapscript

projInObj  = mapscript.projectionObj("init=epsg:4326")
projOutObj = mapscript.projectionObj("init=epsg:42304")

shape = mapscript.shapeObj.fromWKT("POINT(-75 45)")

print shape.toWKT()

if shape.project(projInObj, projOutObj):
  print "Success"
else:
  print "Can't reproject"
  sys.exit(2)

print shape.toWKT()


 

> -----Original Message-----
> From: Tamas Szekeres [mailto:szekerest at gmail.com] 
> Sent: 29 May, 2007 5:32 PM
> To: Kralidis,Tom [Burlington]
> Cc: MAPSERVER-USERS at lists.umn.edu
> Subject: Re: [UMN_MAPSERVER-USERS] Perl mapscript 
> reprojecting WKT issues
> 
> Tom,
> 
> I've tested the equivalent code with c# and Windows, here's 
> the output of the program:
> 
> POINT (-75 45)
> POINT (1578125.6146771896 -198241.98781270601)
> 
> I cannot decide whether the results are correct, but it 
> does't crash anyway.
> 
> Best regards,
> 
> Tamas
> 
> 
> 2007/5/29, Kralidis,Tom [Burlington] <Tom.Kralidis at ec.gc.ca>:
> > > Kralidis,Tom [Burlington] writes:
> > >
> > > > Hi,
> > > >
> > > > MapServer 4.10.0
> > > > FreeBSD
> > > >
> > > > I have a Perl script where I'd like to reproject a WKT
> > > string.  Here's
> > > > the code:
> > > >
> > > > #!/usr/bin/perl
> > > >
> > > > use strict;
> > > > use warnings;
> > > >
> > > > use mapscript 4.10.0;
> > > >
> > > > my $projInObj  = new mapscript::projectionObj("init=epsg:4326");
> > > > my $projOutObj = new 
> mapscript::projectionObj("init=epsg:42304");
> > > >
> > > > my $shape = mapscript::shapeObj::fromWKT("POINT(-75 45)");
> > > >
> > > > print $shape->toWKT()."\n";
> > > >
> > > > $shape->project($projInObj, $projOutObj) || die "Can't 
> reproject:
> > > > $!\n";
> > > >
> > > > print $shape->toWKT()."\n";
> > > >
> > > > The script dies on the shapeObj project call.
> > > >
> > > > Any suggestions or ideas?
> >
> > Can anyone run this script (you might have to change 
> epsg:42304 if you 
> > don't have it defined in your proj epsg file) successfully?
> >
> > I notice that this functionality was as a result of RFC2 
> > (http://mapserver.gis.umn.edu/development/rfc/ms-rfc-2).  Just not 
> > sure if it's my syntax that's off or if this could be a 
> potential bug?
> >
> > ..Tom
> >
> 
> 



More information about the MapServer-users mailing list