[ka-Map-users] how to use mssql database

Kumar kumar at newfields.com
Thu Jun 28 14:15:11 EDT 2007


Hi wang,

            I think you can do that very easily, if you have a monitoring
system setup which feeds the data into sql2000, you can easily make it to
append to a postgres database. I would suggest you using a postgres database
since it has postgis which can store spatial data and mapserver can use it.
You need 2 tables 

 

Location Table with following fields (minimum), Example Shown below


unid

Locid

X_Coord

Y_Coord


1

X1

1234.56

6543.12


2

X2

2345.65

7654.23

 

 

Monitoring_Table

 


uid

Locid

date_time

Parameter

Result


1

X1

1/1/2007

Temperature

35


2

X1

1/1/2007

Humidity

10


3

X1

1/1/2007

radiation

10


4

X1

2/1/2007

Temperature

36


5

X1

2/1/2007

Humidity

11


6

X1

2/1/2007

radiation

11


7

X2

1/1/2007

Temperature

36


8

X2

1/1/2007

Humidity

11


9

X2

1/1/2007

radiation

11


10

X2

2/1/2007

Temperature

37


11

X2

2/1/2007

Humidity

12


12

X2

2/1/2007

radiation

12

 

Then you can make a query which is approximately going to look like this

SELECT 

            Location Table.*,

            Monitoring_Table.*

            setsrid(makepoint(Location Table."X_Coord", Location
Table."Y_Coord"), xxxx ) AS the_geom

FROM

  Monitoring_Table

  RIGHT OUTER JOIN Monitoring_Table ON (Monitoring_Table.locid = Location
Table.locid)

 

This will create the geometry field required for the map file and also put
all the data required for you to display. On the map, its going to show as
single point for each location, but using as use query_float interface in
ka-map to show as a the results as a table. You add modules to ka-map to
make it as map. This is in my todo list for sometime time now, for my
projects. I am assuming you have proper X, Y co-ordinates. 

 

            - kumar

  _____  

From: ka-map-users-bounces at lists.maptools.org
[mailto:ka-map-users-bounces at lists.maptools.org] On Behalf Of stin wang
Sent: Wednesday, June 27, 2007 8:45 PM
To: ka-map-users at lists.maptools.org
Subject: [ka-Map-users] how to use mssql database

 

Hello, lister

I'm fresh to mapserver. I want to do something described as blow; anyone can
give me some idea about how to do is welcome.

I'm do some researches in greenhouse, which means i put some sensors in the
greenhouse, used to monitor some environment parameter ,such as temperature
, humidity, carbon dioxide concentration and radiation. There are several
green houses, so I want to build a webgis so I can check data visually. The
data gathered in greenhouse is send to mssql2000 database server. So my
question is how to show the data in sql2000 in a ka-map interface. 

I have already built a test ka-map, and add a new map to hold my greenhouse
point data. Is there  any idea that can allow me to just click one point
then popup a gage and show a curve describe the variation in a fixed time
series. And future more, maybe I can do some interpolations using kriging
method?? I don't know, maybe you get give me some cues.

-- 
----------------------------------------------
Tie Wang
TianJin Climate Center
TianJin Meterological Bureau
Tianjin, 300074, China 
Email: stin.wang at gmail.com
wangtie at orsi.ouc.edu.cn
       
---------------------------------------------- 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/ka-map-users/attachments/20070628/ef6508e7/attachment-0001.html


More information about the ka-Map-users mailing list