PGSQL Query

Поиск
Список
Период
Сортировка
Искать

PGSQL Query

От:
"Jessica Fendos" <Jessica.Fendos@state.mn.us>
Дата:
Hi list:

I am using sqlquery to build a report in a chameleon
(php/mapscript)-enabled online mapping application. Having little
experience in PostgreSQL, I uploaded a shapefile (empchgfinal.shp)
to PostgreSQL database, created a spatial index (gist type, name
"emp") for the shapefile and wrote the following SQL query in the
html file. However, when I draw the select the area of interest
(using ROI widget) and click generate report, I got an empty result.
Could someone please give me some guidance as to how to fix it?  Any
suggestions will be highly appreciated. 

Sincerely,
Jessica Fendos 



   





  
  

Re: PGSQL Query

От:
"Michael Swierczek" <mike.swierczek@gmail.com>
Дата:
On 4/29/07, Jessica Fendos  wrote:
> Hi list:
>
> I am using sqlquery to build a report in a chameleon
> (php/mapscript)-enabled online mapping application. Having little
> experience in PostgreSQL, I uploaded a shapefile (empchgfinal.shp)
> to PostgreSQL database, created a spatial index (gist type, name
> "emp") for the shapefile and wrote the following SQL query in the
> html file. However, when I draw the select the area of interest
> (using ROI widget) and click generate report, I got an empty result.
> Could someone please give me some guidance as to how to fix it?  Any
> suggestions will be highly appreciated.
>
> Sincerely,
> Jessica Fendos
>

Forgive me for asking the obvious general questions, but can you get
the page to display with a much simpler query, like 'SELECT * FROM
empchg_final LIMIT 1', just to troubleshoot if the connection works at
all?   If that works, can you copy the text of the actual query and
run it against the database directly (through the command line psql or
through pgAdmin 3) to make sure it does not generate an error.

I can't help more than that, as I am not familiar with php.

Good luck.
-Mike

> 
>  username="postgres" password="mapsXXX"  dbtype="PGSQL"
>    sqlquery="select sum(e.aest_00) as avgest00,sum(e.aest_05) as
> avgest05,sum(e.e_est) as
> estchange,round(sum(e.e_est)/sum(e.aest_00)*100, 1) as p_
>    estchg, sum(e.aemp_00) as avgemp00,sum(e.aemp_05) as
> avgemp05,sum(e.e_change) as
> empchange,round(sum(e.e_change)/sum(e.aemp_00)*100, 1)
>    as p_empchange,count(*) as n_blockgroups from empchg_final e
> where e.the_geom && SetSRID('BOX3D([$_MinX_$] [$_MinY_$] ,
> [$_MaxX_$]
>    [$_MaxY_$])'::box3d,-1) AND within (e.the_geom, SetSRID
> ('BOX3D([$_MinX_$] [$_MinY_$],[$_MaxX_$] [$_MaxY_$])'::box3d,-1));"
>    sharedresourcename="EMP">
>    
> 
>
>
> 
> 
>   
>   
FAQ