in reply to Re: Creating a kml filein thread Creating a kml file
The OP also defines $data in the $entity as a string where the documentation specifies it should be a number.