[mapserver-users] MapScript Projection Performance

Even Rouault even.rouault at spatialys.com
Wed Jun 8 09:09:22 PDT 2022


Steve,

are you sure you don't still run into the projection initialization, or 
actually the cost to get the reprojector object from the (in, out) 
projection tuple from the cache maintained by createNormalizedPJ() ?

If the following functions were mapped to SWIG

   MS_DLL_EXPORT reprojectionObj* 
msProjectCreateReprojector(projectionObj* in, projectionObj* out);

   MS_DLL_EXPORT int msProjectPointEx(reprojectionObj* reprojector, 
pointObj *point);

that could be interesting to check if they speed up things.

You might also try to check if using EPSG:4269 instead of EPSG:4326 
wouldn't speed up things, to eliminate the datum change from the 
equation (if you have PROJ grids available, they might be used to do the 
NAD83 -> WGS84 shift)

Even

Le 08/06/2022 à 17:50, Steve Lime a écrit :
> Hi all: I have a Perl script that runs against a shapefile to project 
> a geometry centroid from UTM to Lat/Lon. Code looks something like this:
>
> my $proj_26915 = new mapscript::projectionObj('epsg:26915');
> my $proj_4326 = new mapscript::projectionObj('epsg:4326');
>
> while (my $shape = $layer->nextShape()) {
>     my $point = $shape->getCentroid();
>     $point->project($proj_26915, $proj_4326);
>     # do something with $point
> }
>
> I get the following representative timings with ~250 polygon 
> geometries in the shapefile.
>
>   MapServer 7.4 + Proj 6.2.1 = 0m0.180s
>   MapServer 7.6 + Proj 6.2.1 = 0m7.000s
>   MapServer 8.0 (main) + Proj 7.2.1 = 0m4.300s
>
> Huge difference and things kinda become unusable. Things improve a bit 
> with newer versions but the performance hit is substantial. I 
> thought at first that it was the projection initialization that was 
> taking all the time but it's actually the 
> "$point->project($proj_26915, $proj_4326);" statement.
>
> Perhaps I'm doing something wrong?
>
> --Steve
>
> _______________________________________________
> MapServer-users mailing list
> MapServer-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users

-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the MapServer-users mailing list