parameterized input coordinates & changed to sql upsert command