Search code examples
phppostgresqljavascript-objectsgeojson

How to use JavaScript Geojson object in PHP and postgresql/postgis code as a layer


I want to apply intersect function on two layers in postgresql/postgis using PHP. In which two layers one layer is from front end Geojson javascript Object and another layer is from database itself. Now how-to convert or read the Geojson JavaScript object is PHP postgresql code as a layer. Please help me!


Solution

  • Finally I'm able to reuse Java script Geojson object in PHP and postgresql as a layers as follows. First I converted Java Script object as string and I passed same string in ajax request to PHP file. In PHP file I got a geometry from the passed string by using ST_GeomFromGeoJSON postgis command.