Storing a shapefile into postgresql using PHP -


i'm trying develop php script lets users upload shapefiles import postgis database.

first of all, conversion part, afaik can use shp2pgsql convert shapefile postgresql table; wondering if there way of doing conversion, prefer not use exec() command.

i appretiate idea on storing data in way not require dozens of uniquenamed tables.

there seems no other way using postgresql's binary convert shapefile. although not bad choice, rather not use exec() if there php native function, or apache module it! however, sounds exec sane option available. i'm going use it. no hard feelings! :)

about last part, it's different question , should asked separately. although, i'm afraid there no other way of doing it.

update example added

$queries = shell_exec("shp2pgsql -s ".srid." -c $shpfilpath $tblname")                     or respond(false, "error parsing shapfile."); pg_query($queries) or respond(false, "query failed!"); 
  • srid constant containing "srid"!
  • $shpfilpath path desired shapefile
  • $tblname desired name table

Comments