<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=EN-GB link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi Saber <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks for the suggestion. When I run ogrinfo –formats I see that MySQL is included, so that is not the problem.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>It seems that the issue is about the way that I created and store the line data, because I have tried with some point data and I don’t have this problem – I can create, save, and display points with QGIS and then both OGR and MapServer are OK. But with line data it is different.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I can only assume that QGIS is sending the line data to MySQL in a format that QGIS recognises when the data is retrieved, but which is not recognised by OGR / MapServer.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Going to PostGIS would have to be a last resort, I have a lot of effort invested in MySQL ……<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Chris <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> Saber Razmjooei [mailto:razmjooeis@faunalia.co.uk] <br><b>Sent:</b> 27 July 2011 09:35<br><b>To:</b> Chris Green<br><b>Cc:</b> qgis-user@lists.osgeo.org<br><b>Subject:</b> Re: [Qgis-user] QGIS -> MySQL -> Mapserver ??<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Chris<br><br>I presume your ogr can handle mysql if you can open it in QGIS. But to confirm could you run:<o:p></o:p></p><pre>ogrinfo --formats<o:p></o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><p class=MsoNormal>from terminal and check if you have <br><br>-> "MSSQLSpatial" (read/write)<br><br>Is your database large? Have you considered using PostGIS?<br><br>Cheers<br>Saber<br><br><br>On 27/07/11 07:45, Chris Green wrote: <o:p></o:p></p><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Hi QGIS users<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>I have a problem getting Mapserver to display vector line features which I<o:p></o:p></pre><pre>created with QGIS and saved as spatial objects in MySQL...I asked for some<o:p></o:p></pre><pre>advice on this from the Mapserver forum yesterday but had no responses,<o:p></o:p></pre><pre>perhaps someone in this forum has some experience to offer?<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>As explained in the question below, I can create line features in QGIS, save<o:p></o:p></pre><pre>them in a MySQL table, and recall and display them with QGIS without any<o:p></o:p></pre><pre>problem.  But the same features do not appear to be recognised by OGRInfo or<o:p></o:p></pre><pre>by Mapserver. The line features are saved as BLOB data in a MySQL  MyISAM<o:p></o:p></pre><pre>table in a column which is defined as type 'geometry'. MySQL can create a<o:p></o:p></pre><pre>spatial index of these features.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>The table is accessed by QGIS as a database layer via the 'Add Vector Layer'<o:p></o:p></pre><pre>dialogue. I am using QGIS 1.7. <o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>It's not really a QGIS problem, but I spent all day wrestling with this<o:p></o:p></pre><pre>yesterday but have not solved it.  Any suggestions?<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Chris<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>############################################################################<o:p></o:p></pre><pre>###     <o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>I'm having some trouble with an OGR connection to a MySQL database. The data<o:p></o:p></pre><pre>I'm trying to access was created using QGIS as a line layer and saved in a<o:p></o:p></pre><pre>MySQL table as a BLOB in a geometry column. I can access and properly<o:p></o:p></pre><pre>display this line data using QGIS, but not so far via Mapserver - nothing is<o:p></o:p></pre><pre>drawn and I can't see any error.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>I am using Mapserver 6.0 and my mapfile is very similar to the example in<o:p></o:p></pre><pre>theMapserver / MYSQL  documentation:<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>LAYER<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       NAME "testLine" <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       TYPE   LINE<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       STATUS  DEFAULT<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       CONNECTIONTYPE  OGR<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       CONNECTION  "mysql:testDB,user=admin,password=password,port=3306" <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       DATA "SELECT Geometry from testLine"<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       CLASS<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>              STYLE        <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>                     COLOR  0 0 0<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>                     WIDTH  2      <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>              END # style<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       END # class<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>END # layer<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>If I look at the MySQL table using OGRinfo I see the following:<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Layer name: testLine<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Geometry: Unknown (any)<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Feature Count: 0<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Layer SRS WKT: <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>(unknown)<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>FID Coumn = id<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Geometry Column = Geometry<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>The issue seems to be that OGRInfo and therefore MapServer does not<o:p></o:p></pre><pre>recognise any features in the table, but QGIS using access to the same table<o:p></o:p></pre><pre>finds and displays the features.<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Anyone have any ideas what I am doing wrong?<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre>Chris<o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre> <o:p></o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre>_______________________________________________<o:p></o:p></pre><pre>Qgis-user mailing list<o:p></o:p></pre><pre><a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><o:p></o:p></pre><pre><a href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><o:p></o:p></pre><p class=MsoNormal><o:p> </o:p></p></div></body></html>