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

Chaitanya kumar CH chaitanya.ch at gmail.com
Mon Mar 5 03:37:05 EST 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120305/73d21303/attachment-0001.html


More information about the gdal-dev mailing list