[postgis-devel] Review of AsGML() patch - change of AsGML() parameters

Paul Ramsey pramsey at refractions.net
Thu Sep 6 08:15:07 PDT 2007


Sold, to the man in the yellow hat.

P

Mark Cave-Ayland wrote:
> Hi folks,
> 
> I've finally got around to looking at the GML patches that have been
> lying around in the PostGIS queue and propose the following patch to be
> applied to SVN HEAD.
> 
> The main issue with the AsGML() is that according to the documentation,
> there is no parameter to specify the version of GML being output.
> However on looking at the source code, it becomes apparent that while
> the documentation states:
> 
> 	AsGML(geometry, [precision])
> 	ST_AsGML(geometry, [precision])
> 
> there also exists another prototype like this:
> 
> 	AsGML(geometry, [precision], [version])
> 	ST_AsGML(geometry, [precision], [version])
> 
> This strikes me as not being particularly good by forcing use of
> precision when you wish to specify a version number. It stuck me that a
> far better idea would be to use a similar system system to the new
> operators, and define an alias called _ST_AsGML() which accepts all 3
> parameters: version, geometry and precision. All other functions then
> use SQL aliases to map their parameters onto this function.
> 
> Since the extra version parameter is not documented, I'd like to change
> the parameter order now before it becomes widely used; the irony being
> that if anyone did try and specify a version other than 2, the function
> would exit with an error saying that only GML2 was supported!
> 
> Incidentally the main patch I used for this was posted here:
> http://postgis.refractions.net/pipermail/postgis-devel/2007-July/002690.html. However I did find that the patch had an error in the asgml3_inspected_size() function - when calculating sizes, it was using the asgml_*_size functions instead of the asgml3_*_size functions. So if anyone is using the original posted patch, they may experience memory corruption problems.
> 
> The final function prototype looks like this:
> 
> 	ST_AsGML([version], geom, [precision])
> 
> Does that look like it could work for everyone? If nobody complains,
> I'll apply the patch later this evening. 
> 
> Finally, I'm tempted to add an option version parameter to the ST_AsKML
> and ST_AsSVG prototypes similar to the above so that if new versions
> come along then the modifications can be made without changing the
> existing prototypes. Again, I'll commit this unless anyone loudly
> objects.
> 
> 
> ATB,
> 
> Mark.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel


-- 

   Paul Ramsey
   Refractions Research
   http://www.refractions.net
   pramsey at refractions.net
   Phone: 250-383-3022
   Cell: 250-885-0632



More information about the postgis-devel mailing list