Murat,<div><br></div><div>I see that your view, 
lineview, doesn&#39;t give the expected geometry type with ogrinfo. It is showing the datatype as Real. Check if the datatype of geom is actually string/text.<br><br><div class="gmail_quote">On Tue, Feb 28, 2012 at 12:49 PM, Murat Beyhan <span dir="ltr">&lt;<a href="mailto:beyhan@deprem.gov.tr">beyhan@deprem.gov.tr</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Chaitanya,<br>
<br>
<br>
Map file which is try to draw line as follows<br>
are there any problem on the code<br>
<div class="im"><br>
 LAYER<br>
 NAME sfault1<br>
 CONNECTIONTYPE OGR<br>
 CONNECTION &#39;&lt;OGRVRTDataSource&gt;<br>
 &lt;OGRVRTLayer name=&quot;lineview&quot;&gt;<br>
</div>&lt;SrcDataSource&gt;MYSQL:dynamic,user=root,password=mysqlpasswd,host=localhost,port=3306,tables=lineview&lt;/SrcDataSource&gt;<br>
<div class="im"> &lt;SrcLayer&gt;lineview&lt;/SrcLayer&gt;<br>
 &lt;GeometryType&gt;wkbLineString&lt;/GeometryType&gt;<br>
 &lt;GeometryField encoding=&quot;WKT&quot; field=&quot;geom&quot;/&gt;<br>
 &lt;LayerSRS&gt;WGS84&lt;/LayerSRS&gt;<br>
 &lt;FID&gt;eq_id&lt;/FID&gt;<br>
 &lt;/OGRVRTLayer&gt;<br>
 &lt;/OGRVRTDataSource&gt;&#39;<br>
  DATA sfault1<br>
  STATUS on<br>
  TYPE line<br>
  CLASS<br>
  NAME &quot;Source Fault&quot;<br>
  SYMBOL &quot;cline&quot;<br>
   SIZE 3<br>
  COLOR  0 0 255<br>
  END<br>
  END<br>
<br>
</div>ogrinfo<br>
MYSQL:dynamic,user=root,password=mysqlpasswd,host=localhost,port=3306<br>
sfault -summary<br>
INFO: Open of<br>
`MYSQL:dynamic,user=root,password=mysqlpasswd,host=localhost,port=3306&#39;<br>
      using driver `MySQL&#39; successful.<br>
<br>
Layer name: sfault<br>
Geometry: None<br>
Feature Count: 1<br>
Layer SRS WKT:<br>
(unknown)<br>
eq_id: String (14.0)<br>
lat1: Real (7.4)<br>
lon1: Real (7.4)<br>
lat2: Real (7.4)<br>
lon2: Real (7.4)<br>
<br>
**************linewiew created by following sql statement:*************<br>
<div class="im"><br>
<br>
 create view lineview as select eq_id, &quot;LINESTRING(&quot; + lon1 + &quot; &quot; + lat1<br>
 + &quot;,&quot; + lon2 + &quot; &quot; + lat2 + &quot;)&quot; as geom from sfault<br>
<br>
</div>then<br>
<br>
[murat@localhost ~]$ ogrinfo<br>
MYSQL:dynamic,user=root,password=mysqlpasswd,host=localhost,port=3306<br>
lineview -summary<br>
INFO: Open of<br>
`MYSQL:dynamic,user=root,password=mysqlpasswd,host=localhost,port=3306&#39;<br>
      using driver `MySQL&#39; successful.<br>
<br>
Layer name: lineview<br>
Geometry: None<br>
Feature Count: 1<br>
Layer SRS WKT:<br>
(unknown)<br>
eq_id: String (14.0)<br>
geom: Real (0.0)<br>
<br>
<br>
as you see there is no problem to connect mysql and read information<br>
created mysql geometries from shape file also works here is an example<br>
<br>
[murat@localhost ~]$ ogrinfo<br>
MYSQL:testogr,user=root,password=mysqlpasswd,host=localhost,port=3306<br>
iller -summary<br>
INFO: Open of<br>
`MYSQL:testogr,user=root,password=mysqlpasswd,host=localhost,port=3306&#39;<br>
      using driver `MySQL&#39;<br>
successful.<br>
<br>
Layer name: iller<br>
Geometry: Polygon<br>
Feature Count: 83<br>
Extent: (26.026489, 35.820221) - (44.869179, 42.094917)<br>
Layer SRS WKT:<br>
GEOGCS[&quot;GCS_WGS_1984&quot;,<br>
    DATUM[&quot;WGS_1984&quot;,<br>
        SPHEROID[&quot;WGS_1984&quot;,6378137,298.257223563]],<br>
    PRIMEM[&quot;Greenwich&quot;,0],<br>
    UNIT[&quot;Degree&quot;,0.0174532925199433]]<br>
FID Column = OGR_FID<br>
Geometry Column = SHAPE2<br>
area: Real (13.6)<br>
perimeter: Real (13.6)<br>
illerdd_: Real (0.0)<br>
illerdd_id: Real (0.0)<br>
il_kod: Real (2.0)<br>
iladi: String (20.0)<br>
[murat@localhost ~]$<br>
<br>
<br>
<br>
Now I would like to learn what is wrong with my procedures... please<br>
help<br>
<br>
<br>
<br>
Murat<br>
<div><div class="h5"><br>
<br>
On Tue, 2012-02-28 at 09:03 +0530, Chaitanya kumar CH wrote:<br>
&gt; Murat,<br>
&gt;<br>
&gt;<br>
&gt; Since it is MySQL it doesn&#39;t matter much how you store it. If you are<br>
&gt; going to edit the end points later, storing them as points is<br>
&gt; preferable, otherwise store them as wkt linestring geometries.<br>
&gt;<br>
&gt;<br>
&gt; For your mapfile, first check if the extents are correct. Then check<br>
&gt; if the mapfile works with a shapefile created from the geometries in<br>
&gt; MySQL.<br>
&gt;<br>
&gt; On Tuesday, February 28, 2012, Murat BEYHAN wrote:<br>
&gt;         Chaitanya,<br>
&gt;<br>
&gt;         thanks for your repply,<br>
&gt;<br>
&gt;         Actually I use ogr and mysql to draw point for example<br>
&gt;         epicenter of<br>
&gt;         earthquakes. But this is the first time to draw line which is<br>
&gt;         stored in<br>
&gt;         Mysql as a table. Actually there is no problem on drawing<br>
&gt;         shape file of the<br>
&gt;         line. But I would like to draw it using MySql and ogr<br>
&gt;         functionality. So I<br>
&gt;         have only start and end point of line and I store it on MySql<br>
&gt;         database then<br>
&gt;         I try to draw it considering id of the line by sql statement.<br>
&gt;         Just I would lie to learn how to code it on Mapserver map file<br>
&gt;         and how<br>
&gt;         should I store line on database as a start and stop point of<br>
&gt;         the line or as<br>
&gt;         a geometry . Please help...<br>
&gt;         thanks<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;         On Mon, 27 Feb 2012 22:09:52 +0530, Chaitanya kumar CH wrote<br>
&gt;         &gt; Murat,<br>
&gt;         &gt;<br>
&gt;         &gt; First check if your database is accessible using ogrinfo[1].<br>
&gt;         &gt; Then create a vrt file with the content you specified in the<br>
&gt;         CONNECTION<br>
&gt;         &gt; field of the mapfile. Check if ogrinfo gives expected<br>
&gt;         results with this<br>
&gt;         &gt; file.<br>
&gt;         &gt;<br>
&gt;         &gt; You probably have gdal executables if you are running<br>
&gt;         mapserver.<br>
&gt;         &gt;<br>
&gt;         &gt; [1]: <a href="http://www.gdal.org/ogrinfo.html" target="_blank">http://www.gdal.org/ogrinfo.html</a><br>
&gt;         &gt;<br>
&gt;         &gt; On Mon, Feb 27, 2012 at 12:48 PM, Murat Beyhan<br>
&gt;         &gt; &lt;<a href="mailto:beyhan@deprem.gov.tr">beyhan@deprem.gov.tr</a>&gt; wrote:<br>
&gt;         &gt;<br>
&gt;         &gt; &gt; Dear all,<br>
&gt;         &gt; &gt; I have shared this mail on Mapserver list but could not<br>
&gt;         solve my<br>
&gt;         &gt; &gt; problem.<br>
&gt;         &gt; &gt; Still could not achieve to draw line using start and stop<br>
&gt;         point line<br>
&gt;         &gt; &gt; data stored in MySql database.<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt; I have tried Mr. Robert&#39;s solution but I have faced an<br>
&gt;         error message.<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt; in map file<br>
&gt;         &gt; &gt; I changed Geometrytype from wkbline to wkblinestring.<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt; LAYER<br>
&gt;         &gt; &gt; NAME sfault1<br>
&gt;         &gt; &gt; CONNECTIONTYPE OGR<br>
&gt;         &gt; &gt; CONNECTION &#39;&lt;OGRVRTDataSource&gt;<br>
&gt;         &gt; &gt; &lt;OGRVRTLayer name=&quot;lineview&quot;&gt;<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt;<br>
&gt;         &lt;SrcDataSource&gt;MYSQL:dynamic,user=root,password=mysqlpasswd,host=localhost,po<br>
&gt;         rt=3306,tables=lineview&lt;/SrcDataSource&gt;<br>
&gt;         &gt; &gt; &lt;SrcLayer&gt;lineview&lt;/SrcLayer&gt;<br>
&gt;         &gt; &gt; &lt;GeometryType&gt;wkbLineString&lt;/GeometryType&gt;<br>
&gt;         &gt; &gt; &lt;GeometryField encoding=&quot;WKT&quot; field=&quot;geom&quot;/&gt;<br>
&gt;         &gt; &gt; &lt;LayerSRS&gt;WGS84&lt;/LayerSRS&gt;<br>
&gt;         &gt; &gt; &lt;FID&gt;eq_id&lt;/FID&gt;<br>
&gt;         &gt; &gt; &lt;/OGRVRTLayer&gt;<br>
&gt;         &gt; &gt; &lt;/OGRVRTDataSource&gt;&#39;<br>
&gt;         &gt; &gt;  DATA sfault1<br>
&gt;         &gt; &gt;  STATUS on<br>
&gt;         &gt; &gt;  TYPE line<br>
&gt;         &gt; &gt;  CLASS<br>
&gt;         &gt; &gt;  NAME &quot;Source Fault&quot;<br>
&gt;         &gt; &gt;  SYMBOL &quot;cline&quot;<br>
&gt;         &gt; &gt;   SIZE 3<br>
&gt;         &gt; &gt;  COLOR  0 0 255<br>
&gt;         &gt; &gt;  END<br>
&gt;         &gt; &gt; END<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt; in database<br>
&gt;         &gt; &gt; I have two table<br>
&gt;         &gt; &gt; one is sfault which store<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt; id lat1 lon1 lat2 lon2<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt; and another is lineview which is a view<br>
&gt;         &gt; &gt; of this table created by following<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt; create view lineview as select eq_id, &quot;LINESTRING(&quot; + lon1<br>
&gt;         + &quot; &quot; + lat1<br>
&gt;         &gt; &gt; + &quot;,&quot; + lon2 + &quot; &quot; + lat2 + &quot;)&quot; as geom from sfault<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt; there is an another issue,<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt; I have to draw line by considering id<br>
&gt;         &gt; &gt; so in the map When I select one id, line should be belong<br>
&gt;         to this id&#39;s<br>
&gt;         &gt; &gt; information<br>
&gt;         &gt; &gt; so I have to make a sql statement as follow instead of<br>
&gt;         draw all line<br>
&gt;         &gt; &gt; stored in database I have to draw just one line<br>
&gt;         considering id<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt; something like this:<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt; select eq_id, geom from lineview where id like &#39;%id%&#39;<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt; please help about this subject....<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt; Regards....<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt; Murat<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt; --<br>
&gt;         &gt; &gt; This message has been scanned for viruses and<br>
&gt;         &gt; &gt; dangerous content by MailScanner, and is<br>
&gt;         &gt; &gt; believed to be clean.<br>
&gt;         &gt; &gt;<br>
&gt;         &gt; &gt; _______________________________________________<br>
&gt;         &gt; &gt; gdal-dev mailing list<br>
&gt;         &gt; &gt; <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
&gt;         &gt; &gt; <a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
&gt;         &gt; &gt;<br>
&gt;         &gt;<br>
&gt;         &gt; --<br>
&gt;         &gt; Best regards,<br>
&gt;         &gt; Chaitanya kumar CH.<br>
&gt;         &gt;<br>
&gt;         &gt; <a href="tel:%2B91-9494447584" value="+919494447584">+91-9494447584</a><br>
&gt;         &gt; 17.2416N 80.1426E<br>
&gt;         &gt;<br>
&gt;         &gt; --<br>
&gt;         &gt; This message has been scanned for viruses and<br>
&gt;         &gt; dangerous content by MailScanner, and is<br>
&gt;         &gt; believed to be clean.<br>
&gt;<br>
&gt;<br>
&gt;         Murat Beyhan<br>
&gt;         Jeofizik Yük. Müh.<br>
&gt;         T.C.<br>
&gt;         BAŞBAKANLIK<br>
&gt;         Afet ve Acil Durum Yönetimi Başkanlığı<br>
&gt;         Deprem Dairesi Başkanlığı<br>
&gt;         Eskişehir Yolu 12. Km. Lodumlu/Ankara<br>
&gt;         Tel:+90 (312) 2872680-1550<br>
&gt;<br>
&gt;<br>
&gt;         --<br>
&gt;         This message has been scanned for viruses and<br>
&gt;         dangerous content by MailScanner, and is<br>
&gt;         believed to be clean.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Best regards,<br>
&gt; Chaitanya kumar CH.<br>
&gt;<br>
&gt; <a href="tel:%2B91-9494447584" value="+919494447584">+91-9494447584</a><br>
&gt; 17.2416N 80.1426E<br>
&gt;<br>
&gt; --<br>
&gt; This message has been scanned for viruses and<br>
&gt; dangerous content by MailScanner, and is<br>
&gt; believed to be clean.<br>
<br>
<br>
<br>
</div></div>Murat BEYHAN<br>
<br>
Jeofizik Y.Müh.<br>
T.C. Başbakanlık<br>
<div class="im">Afet ve Acil Durum Yönetimi Başkanlığı<br>
Deprem Dairesi Başkanlığı<br>
Eskişehir Yolu 12. Km.<br>
</div>Lodumlu/ANKARA<br>
Tel: 312 2872680-1556<br>
<a href="mailto:email%3Abeyhan@deprem.gov.tr">email:beyhan@deprem.gov.tr</a><br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
--<br>
This message has been scanned for viruses and<br>
dangerous content by MailScanner, and is<br>
believed to be clean.<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Best regards,<br>Chaitanya kumar CH.<br><br>+91-9494447584<br>17.2416N 80.1426E<br>
</div>