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

Chaitanya kumar CH chaitanya.ch at gmail.com
Mon Feb 27 11:39:52 EST 2012


Murat,

First check if your database is accessible using ogrinfo[1].
Then create a vrt file with the content you specified in the CONNECTION
field of the mapfile. Check if ogrinfo gives expected results with this
file.

You probably have gdal executables if you are running mapserver.

[1]: http://www.gdal.org/ogrinfo.html

On Mon, Feb 27, 2012 at 12:48 PM, Murat Beyhan <beyhan at deprem.gov.tr> wrote:

> Dear all,
> I have shared this mail on Mapserver list but could not solve my
> problem.
> Still could not achieve to draw line using start and stop point line
> data stored in MySql database.
>
> I have tried Mr. Robert's solution but I have faced an error message.
>
>
> in map file
> I changed Geometrytype from wkbline to wkblinestring.
>
> LAYER
> NAME sfault1
> CONNECTIONTYPE OGR
> CONNECTION '<OGRVRTDataSource>
> <OGRVRTLayer name="lineview">
>
> <SrcDataSource>MYSQL:dynamic,user=root,password=mysqlpasswd,host=localhost,port=3306,tables=lineview</SrcDataSource>
> <SrcLayer>lineview</SrcLayer>
> <GeometryType>wkbLineString</GeometryType>
> <GeometryField encoding="WKT" field="geom"/>
> <LayerSRS>WGS84</LayerSRS>
> <FID>eq_id</FID>
> </OGRVRTLayer>
> </OGRVRTDataSource>'
>  DATA sfault1
>  STATUS on
>  TYPE line
>  CLASS
>  NAME "Source Fault"
>  SYMBOL "cline"
>   SIZE 3
>  COLOR  0 0 255
>  END
> END
>
> in database
> I have two table
> one is sfault which store
>
> id lat1 lon1 lat2 lon2
>
> and another is lineview which is a view
> of this table created by following
>
> create view lineview as select eq_id, "LINESTRING(" + lon1 + " " + lat1
> + "," + lon2 + " " + lat2 + ")" as geom from sfault
>
>
> there is an another issue,
>
> I have to draw line by considering id
> so in the map When I select one id, line should be belong to this id's
> information
> so I have to make a sql statement as follow instead of draw all line
> stored in database I have to draw just one line considering id
>
> something like this:
>
> select eq_id, geom from lineview where id like '%id%'
>
>
> please help about this subject....
>
>
> Regards....
>
>
>
> Murat
>
>
>
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>



-- 
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/20120227/d287029a/attachment.html


More information about the gdal-dev mailing list