[mapserver-users] Curved Lines
Mr. Puneet Kishor
punk.kish at gmail.com
Wed Jun 27 07:38:51 PDT 2012
On Jun 27, 2012, at 2:13 AM, juliap wrote:
> Hi all,
>
> I have the following layer of type line :
>
> LAYER
> NAME line
> STATUS ON
> TYPE LINE
> CONNECTIONTYPE OGR
> CONNECTION "MSSQL:server=server;database=database;uid=id;pwd=pwd"
> DATA "SELECT geometry::STLineFromText('LINESTRING ('
> +CAST(Geo.STX AS VARCHAR(54))
> +' '
> +CAST(Geo.STY AS VARCHAR(54))
> +', '
> +CAST(Geo.STX AS VARCHAR(54))
> +' '
> +CAST(Geo.STY AS VARCHAR(54))
> +')'
> ,4326)
> FROM column WHERE DATEDIFF(mi, CreatedON, CURRENT_TIMESTAMP) <='%x%'"
> CLASS
> STYLE
> WIDTH 3
> SIZE 1
> COLOR 0 0 128
> END # end of style
> END # end of class
> PROJECTION
> "init=epsg:4326"
> END # end of projection
> END # end of layer
>
> I was wondering how to get a curved line from this data. I tried using angle
> and gap, but I don't see any changes.
> Any suggestions?
>
Your understanding of geometry is a bit off here. In a query result set, each row is a feature, and a line feature would be made up of two or points; a curved line feature, of course, would be made up of three or more points.
What you are getting in the result set above is a bunch of features, each of which are a point repeated twice. I think what you really want is to create a single line feature from all these points. So, you would probably do some kind of an aggregate on these points. I don't know the functions available in SQL Server, but there must be an analog for Postgres's aggregate functions. You want to collect all the points and make a line feature from them, and then pass that to MapServer to draw. You could make a view that does all this, and then call the view from MapServer.
Hope this helps.
--
Puneet Kishor
More information about the MapServer-users
mailing list