Murat,<br><br>You should check MySQL's SQL syntax to concatenate strings and decimals to produce a string.<br><br>On Wednesday, February 29, 2012, Murat Beyhan <<a href="mailto:beyhan@deprem.gov.tr">beyhan@deprem.gov.tr</a>> wrote:<br>
> Chaitanya,<br>><br>> here is the structure of table on database<br>><br>> sfault :<br>><br>> eq_id varchar(14)<br>> lat1 decimal(7,4)<br>> lon1 decimal(7,4)<br>> lat2 decimal(7,4)<br>> lon2 decimal(7,4)<br>
><br>> lineview :<br>><br>><br>> eq_id varchar(14)<br>> geom double<br>><br>><br>> it seams geom as double<br>> I thing it should be geometry isn't it?<br>><br>> may be I have to change structure of lineview by changing following<br>
> Roberts' suggestion to create view on database<br>><br>> create view lineview as select eq_id, "LINESTRING(" + lon1 + " " + lat1<br>> + "," + lon2 + " " + lat2 + ")" as geom from sfault<br>
><br>><br>> but I'm not sure for the line.<br>><br>> VTR for points, I have tested and works well<br>><br>><br>> but for line still could not achieved yet, please give me another idea.<br>><br>
> here is test.vrt file<br>><br>> <OGRVRTDataSource><br>> <OGRVRTLayer name="sta"><br>> <SrcDataSource>MYSQL:stations,user=root,password=mysql_passwd,host=localhost,port=3306,tables=sta</SrcDataSource><br>
> <SrcSQL>SELECT sta_id as name,type,latitude,longitude from sta where<br>> type like "%SMACH%"</SrcSQL><br>> <GeometryType>wkbPoint</GeometryType><br>> <GeometryField encoding="PointFromColumns" x="longitude" y="latitude"/><br>
> </OGRVRTLayer><br>> </OGRVRTDataSource><br>><br>> and following code gives successful result as you see<br>><br>><br>> ogrinfo -ro -al test.vrt<br>><br>> INFO: Open of `test.vrt' using driver `VRT' successful.<br>
><br>> Layer name: sta<br>> Geometry: Point<br>> Feature Count: 12<br>> Layer SRS WKT:<br>> (unknown)<br>> name: String (12.0)<br>> type: String (24.0)<br>> latitude: Real (5.4)<br>> longitude: Real (5.4)<br>
> OGRFeature(sta):0<br>> name (String) = 0617<br>> type (String) = SMACH<br>> latitude (Real) = 40.4569<br>> longitude (Real) = 32.6319<br>> POINT (32.631900000000002 40.456899999999997)<br>><br>
> OGRFeature(sta):1<br>> name (String) = 0618<br>> type (String) = SMACH<br>> latitude (Real) = 40.4798<br>> longitude (Real) = 32.4555<br>> POINT (32.4555 40.479799999999997)<br>><br>> .<br>> .<br>
> .<br>> .<br>><br>><br>> As you see this works well.<br>><br>> I hope you can catch point what is wrong or lack of on my works....<br>><br>><br>> Thanks again<br>><br>><br>><br>><br>
> On Tue, 2012-02-28 at 18:08 +0530, Chaitanya kumar CH wrote:<br>>> Murat,<br>>><br>>><br>>> I see that your view, lineview, doesn't give the expected geometry<br>>> type with ogrinfo. It is showing the datatype as Real. Check if the<br>
>> datatype of geom is actually string/text.<br>>><br>>> On Tue, Feb 28, 2012 at 12:49 PM, Murat Beyhan <<a href="mailto:beyhan@deprem.gov.tr">beyhan@deprem.gov.tr</a>><br>>> wrote:<br>>> Chaitanya,<br>
>><br>>><br>>> Map file which is try to draw line as follows<br>>> are there any problem on the code<br>>><br>>> LAYER<br>>> NAME sfault1<br>>> CONNECTIONTYPE OGR<br>
>> CONNECTION '<OGRVRTDataSource><br>>> <OGRVRTLayer name="lineview"><br>>><br>>> <SrcDataSource>MYSQL:dynamic,user=root,password=mysqlpasswd,host=localhost,port=3306,tables=lineview</SrcDataSource><br>
>> <SrcLayer>lineview</SrcLayer><br>>> <GeometryType>wkbLineString</GeometryType><br>>> <GeometryField encoding="WKT" field="geom"/><br>
>> <LayerSRS>WGS84</LayerSRS><br>>> <FID>eq_id</FID><br>>> </OGRVRTLayer><br>>> </OGRVRTDataSource>'<br>>> DATA sfault1<br>
>> STATUS on<br>>> TYPE line<br>>> CLASS<br>>> NAME "Source Fault"<br>>> SYMBOL "cline"<br>>> SIZE 3<br>>> COLOR 0 0 255<br>
>> END<br>>> END<br>>><br>>><br>>> 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'<br>>> using driver `MySQL' 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<br>>> statement:*************<br>>><br>>><br>
>> create view lineview as select eq_id, "LINESTRING(" + lon1 +<br>>> " " + lat1<br>>> + "," + lon2 + " " + lat2 + ")" as geom from sfault<br>
>><br>>><br>>> 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'<br>>> using driver `MySQL' 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>>><br><br>-- <br>Best regards,<br>Chaitanya kumar CH.<br><br>+91-9494447584<br>17.2416N 80.1426E<br>