[gdal-dev] drawing line using OGR and mysql in mapserver

Murat Beyhan beyhan at deprem.gov.tr
Mon Mar 5 02:57:55 EST 2012


Chaitanya,

Thanks for your help, I try to use concat to create view from database
which is storing start and end of the point of the line
as follows.


create view lineview6 as select eq_id,
CONCAT('LINESTRING(',lon1,'',lat1,',',lon2,'',lat2,')') as geom from
sfault



but at the previous problem still could not solve
as you said geom field should be string but view automatically decided
the format of the geom column randomly (now is var). then the select sql
result of the view as follows and mapserver does not draw line.


SQL result
Host: localhost
Database: dynamic
Generation Time: Mar 05, 2012 at 09:52 AM
Generated by: phpMyAdmin 3.3.10 / MySQL 5.1.55
SQL query: SELECT * FROM `lineview6` LIMIT 0, 30 ;Rows: 1 

               eq_id
                geom
20100308023229
LINESTRING(38.7901 40.0811,38.7428
40.0311)


and structure of the lineview6 is as follows

eq_id varchar(14)
geom var(51)

please excuse me for this

murat



On Fri, 2012-03-02 at 21:38 +0530, Chaitanya kumar CH wrote:
> Please refer to my previous posts.
> Modify the SQL select command. Use the CONCAT function instead of the
> + operator to create the wkt.
> 
> It should be something like this: CONCAT('LINESTRING(', x1, ' ', y1,
> ',', x2, ' ', y2, ')')
> You may have to change the order of the points.
> 
> On Fri, Mar 2, 2012 at 9:24 PM, Murat Beyhan <beyhan at deprem.gov.tr>
> wrote:
>         Chaitanya,
>         
>         I store data in table not view as I told you before becasue I
>         could not
>         declare column as string, then I create a new table and select
>         fault(line) column as linestring. in mysql WKT support these
>         format
>         
>         
>              * A LineString with four points:
>         
>                LINESTRING(0 0, 10 10, 20 25, 50 60)
>         
>                Note that point coordinate pairs are separated by
>         commas.
>         
>              * A Polygon with one exterior ring and one interior ring:
>         
>                POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5
>         5))
>              * A MultiPoint with three Point values:
>         
>                MULTIPOINT(0 0, 20 20, 60 60)
>              * A MultiLineString with two LineString values:
>         
>                MULTILINESTRING((10 10, 20 20), (15 15, 30 15))
>              * A MultiPolygon with two Polygon values:
>         
>                MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)),((5 5,7 5,7
>         7,5 7, 5 5)))
>              * A GeometryCollection consisting of two Point values and
>         one
>                LineString:
>         
>                GEOMETRYCOLLECTION(POINT(10 10), POINT(30 30),
>         LINESTRING(15 15, 20 20))
>         
>         
>         How to modify wkt geometry  in string format
>         in map file it is already defined as
>         <GeometryType>wkbLineString</GeometryType>
>         like this.
>         
>         I really sorry for giving trouble to you. Thanks
>         
>         murat
>         
>         On Fri, 2012-03-02 at 21:19 +0530, Chaitanya kumar CH wrote:
>         > Modify the table to store the line as a wkt geometry in
>         string format.
>         >
>         > On Fri, Mar 2, 2012 at 9:12 PM, Murat Beyhan
>         <beyhan at deprem.gov.tr>
>         > wrote:
>         >         Chaitanya,
>         >
>         >         I mean What should I do,
>         >         Still could not draw a simple line on the map,
>         >         Please how can I overcome this issue. How can I
>         change VRT
>         >         file.
>         >         in order to read data from such table storing data
>         as
>         >         linestring
>         >
>         >         regards
>         >
>         >         murat
>         >         On Fri, 2012-03-02 at 21:08 +0530, Chaitanya kumar
>         CH wrote:
>         >         > I was talking about the geometry format of the
>         line. You
>         >         have to
>         >         > decide for yourselves about the efficiency.
>         >         >
>         >         > On Fri, Mar 2, 2012 at 8:57 PM, Murat Beyhan
>         >         <beyhan at deprem.gov.tr>
>         >         > wrote:
>         >         >         Chaitanya,
>         >         >
>         >         >         What do you prefer and which way more fast
>         to draw
>         >         line and
>         >         >         point
>         >         >         because I also draw point about 160000 and
>         I use
>         >         wkbpoint.
>         >         >
>         >         >         Any way how to change and What I will
>         change in the
>         >         vrt.
>         >         >
>         >         >         could you tell something about it
>         >         >         thanks
>         >         >
>         >         >
>         >         >         On Fri, 2012-03-02 at 20:23 +0530,
>         Chaitanya kumar
>         >         CH wrote:
>         >         >         > Murat,
>         >         >         >
>         >         >         > You specified the encoding for
>         GeometryField in
>         >         the VRT as
>         >         >         WKT. OGR
>         >         >         > expects a WKT if you do that. Either
>         change the
>         >         data or the
>         >         >         VRT.
>         >         >         >
>         >         >         > On Fri, Mar 2, 2012 at 6:42 PM, Murat
>         Beyhan
>         >         >         <beyhan at deprem.gov.tr>
>         >         >         > wrote:
>         >         >         >         I have to say this is not view
>         >         >         >         this is a table created.
>         >         >         >
>         >         >         >         Because I could not declare type
>         of geom
>         >         field as a
>         >         >         string
>         >         >         >         than I create
>         >         >         >         geometry field column in spatial
>         mysql
>         >         database..
>         >         >         >
>         >         >         >
>         >         >         >         On Fri, 2012-03-02 at 18:39
>         +0530,
>         >         Chaitanya kumar
>         >         >         CH wrote:
>         >         >         >         > Murat,
>         >         >         >         >
>         >         >         >         > Can you show a sample output
>         of your
>         >         view?
>         >         >         >         > SELECT * FROM geom;
>         >         >         >         >
>         >         >         >         > On Fri, Mar 2, 2012 at 6:12
>         PM, Murat
>         >         Beyhan
>         >         >         >         <beyhan at deprem.gov.tr>
>         >         >         >         > wrote:
>         >         >         >         >
>         >         >         >         >
>         >         >         >         >
>         >         >         >         >
>         >         >         >         >         Dear Chaitanya,
>         >         >         >         >
>         >         >         >         >         I see what you explain
>         first I
>         >         convert lat
>         >         >         lon data
>         >         >         >         to string
>         >         >         >         >         then I
>         >         >         >         >         concatenate them to
>         string
>         >         again. But I
>         >         >         would like
>         >         >         >         to ask
>         >         >         >         >         I have already add
>         data to mysql
>         >         table as
>         >         >         follows is
>         >         >         >         this also
>         >         >         >         >         correct
>         >         >         >         >         because when I browse
>         table it
>         >         seems it
>         >         >         store data
>         >         >         >         in geometry
>         >         >         >         >         field
>         >         >         >         >         but mapserver gives
>         error
>         >         >         >         >         Unable to identify
>         source field
>         >         'fault'
>         >         >         for
>         >         >         >         geometry.
>         >         >         >         >         any way
>         >         >         >         >         I will try to convert
>         data first
>         >         then I
>         >         >         can return
>         >         >         >         back you.
>         >         >         >         >         Regards...
>         >         >         >         >
>         >         >         >         >         ps.
>         >         >         >         >
>         >         >         >         >         ogrinfo
>         >         >         >         >
>         >         >         >
>         >         >
>         >
>         MYSQL:dynamic,user=root,password=mysql_123,host=localhost,port=3306,tables=geom
>         >         >         >         >         INFO: Open of
>         >         >         >         >
>         >         >         >
>         >         >
>         >
>         `MYSQL:dynamic,user=root,password=mysql_123,host=localhost,port=3306,tables=geom'
>         >         >         >         >              using driver
>         `MySQL'
>         >         successful.
>         >         >         >         >         1: geom (None)
>         >         >         >         >
>         >         >         >         >
>         >         >         >         >
>         >         >         >         >
>         >         >         >         >         it say none in geom
>         >         >         >         >         may be first I have to
>         do what
>         >         you say
>         >         >         >         >         thanks
>         >         >         >         >         Murat
>         >         >         >         >
>         >         >         >         >
>         >         >         >         >
>         >         >         >         > --
>         >         >         >         > Best regards,
>         >         >         >         > Chaitanya kumar CH.
>         >         >         >         >
>         >         >         >         > +91-9494447584
>         >         >         >         > 17.2416N 80.1426E
>         >         >         >         >
>         >         >         >
>         >         >         >         > --
>         >         >         >         > This message has been scanned
>         for
>         >         viruses and
>         >         >         >         > dangerous content by
>         MailScanner, and is
>         >         >         >         > believed to be clean.
>         >         >         >
>         >         >         >
>         >         >         >
>         >         >         >         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.
>         >         >         >
>         >         >         >
>         >         >         >
>         >         >         >
>         >         >         >
>         >         >         > --
>         >         >         > Best regards,
>         >         >         > Chaitanya kumar CH.
>         >         >         >
>         >         >         > +91-9494447584
>         >         >         > 17.2416N 80.1426E
>         >         >         >
>         >         >         > --
>         >         >         > This message has been scanned for
>         viruses and
>         >         >         > dangerous content by MailScanner, and is
>         >         >         > believed to be clean.
>         >         >
>         >         >
>         >         >
>         >         >         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.
>         >         >
>         >         >
>         >         >
>         >         >
>         >         >
>         >         > --
>         >         > Best regards,
>         >         > Chaitanya kumar CH.
>         >         >
>         >         > +91-9494447584
>         >         > 17.2416N 80.1426E
>         >         >
>         >         > --
>         >         > This message has been scanned for viruses and
>         >         > dangerous content by MailScanner, and is
>         >         > believed to be clean.
>         >
>         >         --
>         >
>         >         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.
>         >
>         >
>         >
>         >
>         >
>         > --
>         > Best regards,
>         > Chaitanya kumar CH.
>         >
>         > +91-9494447584
>         > 17.2416N 80.1426E
>         >
>         > --
>         > This message has been scanned for viruses and
>         > dangerous content by MailScanner, and is
>         > believed to be clean.
>         
>         
>         
>         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.
>         
>         
> 
> 
> 
> -- 
> Best regards,
> Chaitanya kumar CH.
> 
> +91-9494447584
> 17.2416N 80.1426E
> 
> -- 
> This message has been scanned for viruses and 
> dangerous content by MailScanner, and is 
> believed to be clean.



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 gdal-dev mailing list