[mapserver-users] Curved Lines

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Wed Jun 27 07:47:43 PDT 2012


Hi,

The question, if I understand is correctly, is relevant. In EPSG:4326 shortest distance between two points is better expressed as a curve than as a straight linestring. However, Mapserver does not support curves of any kind.

You may find some workaround from GDAL. Ogr2ogr is having a "segmentize" option for this purpose. It does not support real curves either, but it creates intermediate points so that linestrings are shorter and thus follow the curve better. See http://gdal.org/ogr2ogr.html

-Jukka Rahkonen-

> -----Alkuperäinen viesti-----
> Lähettäjä: mapserver-users-bounces at lists.osgeo.org 
> [mailto:mapserver-users-bounces at lists.osgeo.org] Puolesta Mr. 
> Puneet Kishor
> Lähetetty: 27. kesäkuuta 2012 17:39
> Vastaanottaja: juliap
> Kopio: mapserver-users at lists.osgeo.org
> Aihe: Re: [mapserver-users] Curved Lines
> 
> 
> 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
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 


More information about the mapserver-users mailing list