[Geomoose-users] Search based on lat/lon layer

Dan Little danlittle at yahoo.com
Sat Apr 25 08:55:40 EDT 2009


Option #2 will be difficult for Brent as he is using 1.6.X


----- Original Message ----
> From: Jim Klassen <Jim.Klassen at ci.stpaul.mn.us>
> To: bfraser at geoanalytic.com; geomoose-users at lists.sourceforge.net
> Sent: Friday, April 24, 2009 5:16:27 PM
> Subject: Re: [Geomoose-users] Search based on lat/lon layer
> 
> Two thoughts.
> 
> 1) There have been recent changes to shpext and some of the other related tags 
> in mapserver templates that support supplying an output projection. (or at least 
> transforming them to the mapfiles output projection).... that reminds me I need 
> to make a ticket for one of those changes.
> 
> http://trac.osgeo.org/mapserver/ticket/2961
> 
> Anyway... I already did that.
> --- maptemplate.c    (revision 8844)
> +++ maptemplate.c    (working copy)
> @@ -3282,14 +3282,23 @@
>          }
>        }
>      }
> -    
> -    sprintf(repstr, "%f %f", (mapserv->resultshape.bounds.maxx + 
> mapserv->resultshape.bounds.minx)/2, (mapserv->resultshape.bounds.maxy + 
> mapserv->resultshape.bounds.miny)/2); 
> -    outstr = msReplaceSubstring(outstr, "[shpmid]", repstr);
> -    sprintf(repstr, "%f", (mapserv->resultshape.bounds.maxx + 
> mapserv->resultshape.bounds.minx)/2);
> -    outstr = msReplaceSubstring(outstr, "[shpmidx]", repstr);
> -    sprintf(repstr, "%f", (mapserv->resultshape.bounds.maxy + 
> mapserv->resultshape.bounds.miny)/2);
> -    outstr = msReplaceSubstring(outstr, "[shpmidy]", repstr);
> -    
> +  
> +    { 
> +        rectObj tempExtent;
> +        tempExtent.minx = mapserv->resultshape.bounds.minx;
> +        tempExtent.maxx = mapserv->resultshape.bounds.maxx;
> +        tempExtent.miny = mapserv->resultshape.bounds.miny;
> +        tempExtent.maxy = mapserv->resultshape.bounds.maxy;
> +        if(msProjectionsDiffer(&(mapserv->resultlayer->projection), 
> &(mapserv->map->projection))) 
> +             msProjectRect(&(mapserv->resultlayer->projection), 
> &mapserv->map->projection, &tempExtent);  
> +        sprintf(repstr, "%f %f", (mapserv->resultshape.bounds.maxx + 
> mapserv->resultshape.bounds.minx)/2, (mapserv->resultshape.bounds.maxy + 
> mapserv->resultshape.bounds.miny)/2); 
> +        outstr = msReplaceSubstring(outstr, "[shpmid]", repstr);
> +        sprintf(repstr, "%f", (tempExtent.maxx + tempExtent.minx)/2);
> +        outstr = msReplaceSubstring(outstr, "[shpmidx]", repstr);
> +        sprintf(repstr, "%f", (tempExtent.maxy + tempExtent.miny)/2);
> +        outstr = msReplaceSubstring(outstr, "[shpmidy]", repstr);
> +    }
> +
>      if(processExtentTag(mapserv, &outstr, "shpext", 
> &(mapserv->resultshape.bounds), &(mapserv->resultlayer->projection)) != 
> MS_SUCCESS)
>        return(NULL);
>      if(processExtentTag(mapserv, &outstr, "shpext_esc", 
> &(mapserv->resultshape.bounds), &(mapserv->resultlayer->projection)) != 
> MS_SUCCESS) /* depricated */
> 
> 
> 2) You can reproject using the OpenLayers code: Something along the lines of: 
> coord = {'x': x_coord, 'y': y_coord}; OpenLayers.Projection.transform({'x': lon, 
> 'y': lat}, , LatLongProjection); ll = {'lon': 
> coord.x, 'lat': coord.y} ; Map.panTo(ll);
> (From memory, check the projection call from geomoose/main.js)
> 
> >>> Brent Fraser 04/24/09 4:32 PM >>>
>   I've got a layer in geographic coordinates I'd like to do a GeoMoose Search 
> on.  Unfortunately, Mapserver's shpminx/shpmaxx/shpminx/shpmaxx template values 
> return the shape extents in the layer's coordinate system, not the map 
> coordinate system, so the GeoMoose Map.zoomToViewString call in the itemquery 
> template does not work.
> 
>   Has anyone got a Map.zoomToLatLonViewString function laying around?
> 
> My other options are:
>   Convert the layer to the map projection (a maintenance nightmare)
>   Enhance Mapserver's [shpmin} handling to match it's [shpext proj=] abilities 
> (too much work right now)
> 
> Thanks!
> Brent Fraser
> 
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensign option that enables unlimited
> royalty-free distribution of the report engine for externally facing 
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Geomoose-users mailing list
> Geomoose-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geomoose-users
> 
> 
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensign option that enables unlimited
> royalty-free distribution of the report engine for externally facing 
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Geomoose-users mailing list
> Geomoose-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geomoose-users



      




More information about the Geomoose-users mailing list