Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $db = pg_connect("host=172.31.4.61 port=5432 dbname=geoserver user=postgres password=ndem$123") or die ("cant");
- $data_query = "SELECT row_to_json(fc) FROM ( SELECT 'FeatureCollection' As type, array_to_json(array_agg(f)) As features";
- $data_query .= " FROM (SELECT 'Feature' As type";
- $data_query .= ", ST_AsGeoJSON(lg.geom)::json As geometry";
- $data_query .= ", row_to_json((SELECT l FROM (SELECT taluk) As l";
- $data_query .=" )) As properties";
- $data_query .= " FROM s50k.aptaluk50soi2001 As lg ) As f ) As fc";
- $data = pg_query($db,$data_query);
- while ($row_p = pg_fetch_row($data) )
- {
- $count = count($row_p);
- $y = 0;
- while ($y < $count)
- {
- $c_row = current($row_p);
- $lat_lon.= $c_row . ",";
- next($row_p);
- $y = $y + 1;
- }
- }
- echo $lat_lon;
- ?>
- <?php
- $db = pg_connect("host=172.31.4.61 port=5432 dbname=geoserver user=postgres password=ndem$123") or die ("cant");
- $mapa = "SELECT geom FROM s50d.aptirupatiff50dsc01042014";
- $dbquery = pg_query($db,$mapa);
- //echo("hello");
- $geojson = array( 'type' => 'FeatureCollection', 'features' => array());
- while($row = pg_fetch_array($dbquery)){
- $marker = array(
- 'type' => 'Feature',
- 'features' => array(
- 'type' => 'Feature',
- 'properties' => array(
- 'gid' => "serial"
- )
- )
- );
- array_push($geojson['features'], $marker['features']);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement