Ticket #422 (closed defect: fixed)

Opened 5 years ago

Last modified 2 months ago

lat/lon mapxy doesn't project to map's projection

Reported by: brian@christianity.com Assigned to: sdlime
Priority: high Milestone:
Component: MapServer CGI Version: 3.6
Severity: normal Keywords:
Cc:

Description

I posted this to the mailing list as well, but just in case it's a legitimate bug:

(for Mapserver 3.6.6)

I was finding that when I passed long/lat coordinates as the mapxy along
with a 'buffer' against a mapfile that had lcc projection, the mapPoint
that was being used remained in longitude/latitude coordinates.  The
extent was getting computed based on the (still) long/lat coordinates,
so the resulting map was way off.

around line 420, inside mapserv.c, in function "loadForm", under

    if(strcasecmp(msObj->ParamNames[i],"mapxy") == 0) { // user map
coordinate

there is:

#ifdef USE_PROJ

        if(msObj->Map->projection.proj &&
!pj_is_latlong(msObj->Map->projection.proj)
           && (msObj->MapPnt.x >= -180.0 && msObj->MapPnt.x <= 180.0) 
           && (msObj->MapPnt.y >= -90.0 && msObj->MapPnt.y <= 90.0))

          // My patch: this used to pass
          // msObj->Map->projection as the first argument...
          // I switched it to msObj->Map->latlon instead, 
          // so the coordinates are properly converted.
          // ... old --> msProjectPoint(&(msObj->Map->projection), 
          msProjectPoint(&(msObj->Map->latlon), 
                         &(msObj->Map->projection), 
                         &msObj->MapPnt); // point is a in lat/lon

#endif


My suggested patch appears inline above.  Basically, when the point is
being projected, the source and target projections are the same, in the
original source code (both msObj->Map->projection).  Inside the if
statement, we know we want to go from lat/lon coordinates to the
projection coordinates, so it seemed to make sense to me that the first
argument should be msObj->Map->latlon, instead.  

I made this change, and now my system is working just fine.  

Please let me know if this is an invalid fix.

Thanks,
Brian

Change History

05/07/08 19:49:33 changed by pramsey

  • status changed from new to closed.
  • resolution set to fixed.

The source code in trunk reflects the suggested patch, it must have been fixed at some point and not closed.