Rāda ziņas ar etiķeti mysql. Rādīt visas ziņas
Rāda ziņas ar etiķeti mysql. Rādīt visas ziņas

2011-08-31

google maps and proj4js. movable marker

Another script which combines proj4js and google maps together. This one gets coordinates from one system (EPSG:25884) which are generated in input boxes (and if there is none or wrong format, gives default values), converts to wgs84 lat/long and sets a movable marker on the google maps. As the user is moving marker, it defines the new center of the map after the user releases it and the new coordinates has been calculated back from lat/long to epsg:25884 and putted in the text box.

2011-08-30

Linear interpolator script

Mostly measured data in databases are defined in exact time or date. But sometimes it is necessary to interpolate between different dates because of skipped measurements. For example, in earlier times, groundwater level measurements were made "by hand" after every three to seven days, depending of site and monitoring type. But nowadays groundwater has been monitored using different loggers, which are called - divers. These little gadgets gives possibility to get daily data.


The problem is that working with daily measurements and not taking care about skipped days, statistical weights could be different from the case, when in these skipped days the measurements are  interpolated.

I made a little script, where measurements and their corresponding dates are taken from mySQL database using PHP; and in the database there could be only measured data - this script interpolates the missing values.

2011-03-02

daily data

PHP mysql database code for wells. daily results for all wells.
Sometimes there`s a need for daily data, but in database there are records only about those days, when measurements were made.
In given example, it is possible to set the start and end days, and multiple measurement points a.k.a. wells.

2011-02-25

HeidiSQL

Very nice program to access remote SQL server.
Also, I`ve learned some neat things about MySql functions and extended use.
For example, here is some code
What does it do?
It`s looking for all similar months and returns an average value from all values on given month.
In the inner "select" I`m selecting all columns and I`m adding additional column, where the each month (meneshi) is added in each row using "where"
And then in the outer query I`m gruping values by newly created month column and calling an average function. It returns all average values for each group - month.
And lastly I`m ordering results by month. Easy as pie, actually.

Only thing I need to change is "ns" in third line from end of the script.
Next challenge would be to make average results for all ns.
select avg(lim), datums, meneshi
from
( select ns, lim, datums,
CASE
WHEN datums like '19__-01-__%' THEN '01'
WHEN datums like '19__-02-__%' THEN '02'
WHEN datums like '19__-03-__%' THEN '03'
WHEN datums like '19__-04-__%' THEN '04'
WHEN datums like '19__-05-__%' THEN '05'
WHEN datums like '19__-06-__%' THEN '06'
WHEN datums like '19__-07-__%' THEN '07'
WHEN datums like '19__-08-__%' THEN '08'
WHEN datums like '19__-09-__%' THEN '09'
WHEN datums like '19__-10-__%' THEN '10'
WHEN datums like '19__-11-__%' THEN '11'
WHEN datums like '19__-12-__%' THEN '12' END as meneshi
from hmetlimeni where ns=9664 ) as tble
group by meneshi
order by meneshi