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

Chaitanya kumar CH chaitanya.ch at gmail.com
Mon Mar 5 08:49:19 EST 2012


At this point I could only advice you to refer to MySQL documentation.

http://dev.mysql.com/doc/
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html

On Mon, Mar 5, 2012 at 7:00 PM, Murat Beyhan <beyhan at deprem.gov.tr> wrote:

> Chaitanya,
> I could not succeeded What I have tried.
> the problem is I'm not good at mysql.
> I think I could not do this job.
> I'm really upset.
> Are there a different way or easy way to draw line using mysql table
> data..
> Regards
>
>
> On Mon, 2012-03-05 at 10:44 +0200, Murat Beyhan wrote:
> > Chaitanya,
> >
> > I was forget to convert lat lon to string as you said before than I was
> > use BINARY to convert it but I could not converted ı think because still
> > same problem continuing.
> >
> > as follows
> >
> >
> > CREATE OR REPLACE
> > ALGORITHM = UNDEFINED
> > VIEW `lineview3` (
> > eq_id,
> > geom
> > ) AS
> > SELECT eq_id,
> > BINARY CONCAT( 'LINESTRING(', lon1, ' ', lat1, ',', lon2, ' ', lat2,
> > ')' ) AS geom
> > FROM sfault
> >
> >
> > Ok, I will tyr cast. By the way I learn more about mysql, too..
> > thanks
> > Murat
> >
> >
> > On Mon, 2012-03-05 at 14:07 +0530, Chaitanya kumar CH wrote:
> > > Murat,
> > >
> > > Perhaps you can use the CAST operator to convert the data type to
> > > varchar.
> > >
> > > On Monday, March 5, 2012, Murat Beyhan <beyhan at deprem.gov.tr> wrote:
> > > > 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
> > > >
> > >
> > > --
> > > 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
> >
> >
> >
> >
>
>
>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120305/f484e199/attachment-0001.html


More information about the gdal-dev mailing list