[mapserver-users] draw line readinf from mysql
Murat Beyhan
beyhan at deprem.gov.tr
Thu Mar 1 00:55:34 PST 2012
Dear All,
I have solved to read data from virtual data access using ogr and Mysql
but my mapserver gives an error message, Please let me know What I'm
doing wrong.
the map file layer for drawing line as follows
LAYER
NAME sfault1
connectiontype ogr
CONNECTION '<OGRVRTDataSource>
<OGRVRTLayer name="dynamic">
<SrcDataSource>MYSQL:dynamic,user=root,password=mysql_passwd,host=localhost,port=3306,tables=lineview1</SrcDataSource>
<SrcSql>select eq_id, geom from lineview1 where eq_id like "%eq_id%"
</SrcSql>
<GeometryType>wkbLineString</GeometryType>
<GeometryField encoding="WKT" field="geom"/>
<MySQL_FID>eq_id</MySQL_FID>
</OGRVRTLayer>
</OGRVRTDataSource>'
DATA sfault1
STATUS default
TYPE line
CLASS
name "Kaynak Fay1/Source Fault"
SYMBOL "cline"
SIZE 6
COLOR 0 255 255
END
END
ogr vrt can access succesfully
to mysql as follows
[murat at localhost stations]$ ogrinfo -ro -al test.vrt
INFO: Open of `test.vrt'
using driver `VRT' successful.
Layer name: dynamic
Geometry: Line String
Feature Count: 2
Layer SRS WKT:
(unknown)
eq_id: String (42.0)
geom: Real (23.0)
OGRFeature(dynamic):0
eq_id (String) = 20111023101120
geom (Real) = 164
OGRFeature(dynamic):1
eq_id (String) = 20100308023229
geom (Real) = 163
please give me hint What Shall I do
Regards
Murat
On Fri, 2012-02-24 at 12:38 +0200, Murat Beyhan wrote:
> Dear all,
>
> Still could not achieve to draw line using start and stop point line
> data stored in MySql database.
>
> I have tried Mr. Robert's solution but I have faced an error message.
>
>
> in map file
> I changed Geometrytype from wkbline to wkblinestring.
>
> LAYER
> NAME sfault1
> CONNECTIONTYPE OGR
> CONNECTION '<OGRVRTDataSource>
> <OGRVRTLayer name="lineview">
> <SrcDataSource>MYSQL:dynamic,user=root,password=mysqlpasswd,host=localhost,port=3306,tables=lineview</SrcDataSource>
> <SrcLayer>lineview</SrcLayer>
> <GeometryType>wkbLineString</GeometryType>
> <GeometryField encoding="WKT" field="geom"/>
> <LayerSRS>WGS84</LayerSRS>
> <FID>eq_id</FID>
> </OGRVRTLayer>
> </OGRVRTDataSource>'
> DATA sfault1
> STATUS on
> TYPE line
> CLASS
> NAME "Source Fault"
> SYMBOL "cline"
> SIZE 3
> COLOR 0 0 255
> END
> END
>
> in database
> I have two table
> one is store id lat1 lon1 lat2 lon2
> and another is view
> of this table created by following
>
> create view lineview as select eq_id, "LINESTRING(" + lon1 + " " + lat1
> + "," + lon2 + " " + lat2 + ")" as geom from sfault
>
>
> there is an another issue,
> I have to draw line by considering id
> so in the map When I select one id, line should be belong to this id's
> information
> so I have to make a sql statement as follow instead of draw all line
> stored in database I have to draw just one line considering id
>
> something like this select eq_id, geom from lineview where id like '%id
> %'
>
>
> please help about this subject....
>
>
> Regards....
>
>
>
> Murat
>
>
>
> On Tue, 2012-02-21 at 09:15 +1300, Robert Sanson wrote:
> > Hi Murat
> >
> > Is it possible for you to create a view from the columns that presents the data as a WKT line feature:
> >
> > create view lineview as select id, "LINESTRING(" + lon1 + " " + lat1 + "," + lon2 + " " + lat2 + ")" as geom from mytable
> >
> > Then set up your OGR ovf file representing this view:
> >
> > <OGRVRTDataSource>
> > <OGRVRTLayer name="fences">
> > <SrcDataSource>ODBC:user/passwd at DSN</SrcDataSource>
> > <SrcLayer>lineview</SrcLayer>
> > <GeometryType>wkbLine</GeometryType>
> > <LayerSRS>EPSG:2193</LayerSRS>
> > <GeometryField encoding="WKT" field="geom"/>
> > <FID>id</FID>
> > </OGRVRTLayer>
> > </OGRVRTDataSource>
> >
> > Best wishes,
> >
> > Robert
> >
> > >>> Murat Beyhan <beyhan at deprem.gov.tr> 21/02/2012 2:52 a.m. >>>
> > Dear friend,
> >
> > I'm trying to draw a line using MySql database
> > the table in database as follows,
> >
> > id lat1 lon1 lat2 lon2
> > 20100308023229 40.1113 38.7901 40.0311 38.7428
> >
> > actually using ogr connection I can draw point using ogr and mysql, but
> > How can I draw line using such database table, please help me and give
> > the idea...
> >
> > Thanks
> >
> > Murat
> > --
> > Murat BEYHAN
> > Geophysical Engineer, M.Sc.
> > Prime Ministry
> > Disaster and Emergency Management Presidency
> > Earthquake Department
> > Address: Eskisehir Yolu 12. Km.
> > Lodumlu/ANKARA
> > Tel: 312 2872680-1556
> > email:beyhan at deprem.gov.tr
> >
> >
> >
> > --
> > This message has been scanned for viruses and
> > dangerous content by MailScanner, and is
> > believed to be clean.
> >
> > _______________________________________________
> > mapserver-users mailing list
> > mapserver-users at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapserver-users
> >
> >
> >
> > This email and any attachments are confidential and intended solely for the addressee(s). If you are not the intended recipient, please notify us immediately and then delete this email from your system.
> >
> > This message has been scanned for Malware and Viruses by Websense Hosted Security.
> > www.websense.com
> >
>
>
>
> Murat BEYHAN
>
> Jeofizik Y.Müh.
> T.C. Başbakanlık
> Afet ve Acil Durum Yönetimi Başkanlığı
> Deprem Dairesi Başkanlığı
> Eskişehir Yolu 12. Km.
> Lodumlu/ANKARA
> Tel: 312 2872680-1556
> email:beyhan at deprem.gov.tr
>
>
>
>
Murat BEYHAN
Jeofizik Y.Müh.
T.C. Başbakanlık
Afet ve Acil Durum Yönetimi Başkanlığı
Deprem Dairesi Başkanlığı
Eskişehir Yolu 12. Km.
Lodumlu/ANKARA
Tel: 312 2872680-1556
email:beyhan at deprem.gov.tr
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the MapServer-users
mailing list