Re: [mapserver-users] [EXTERNAL] Re: the lines one above other

2015-02-13 Thread Vladimir
 Sorry, I have some correction, it is right illustrations:

Result when order by asc:
http://s28.postimg.org/lqs8nxw31/asc.jpg
Result when order by desc:
http://s12.postimg.org/xondilekt/desc.jpg

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] [EXTERNAL] Re: the lines one above other

2015-02-13 Thread Vladimir

I would draw your attention to the source of this discussion.
http://osgeo-org.1560.x6.nabble.com/the-lines-one-above-other-td5187093.html
It seems I found how to display multilevel junction of highway with ORDER BY 
in the case using a one layer. Adding order by id desc or order by id asc 
in subquery, also the definition $highwayStyle2 besides $highwayStyle1 works 
fine.
Please see the code and the illustrations below:

--
$highwayLayer-set('status', MS_ON);
$highwayLayer-set('name', 'highway');
$highwayLayer-set('labelitem', 'name');
$highwayLayer-setConnectionType(MS_POSTGIS);
$highwayLayer-set('connection', 'user=my_user password=my_pass dbname=my_db 
host=localhost');
$highwayLayer-set(data,geom from (select id, 'id = '||id as name, geom from 
my_table
where ST_Intersects(geom, !BOX!) order by id desc) as subquery using unique id 
using srid=3857);
$highwayLayer-setprocessing(close_connection=defer);
$highwayLayer-set(type,MS_LAYER_LINE);
$highwayClass = new ClassObj($highwayLayer);
$highwayClass-set('name', 'highway');
$highwayStyle1 = new styleObj($highwayClass); 
$highwayStyle1-color-setRGB(254,173,0);
$highwayStyle1-set('linecap','square'); 
$highwayStyle1-set('width',4);
$respdorStyle1-outlinecolor-setRGB(255,0,0); 
$respdorStyle1-set('outlinewidth',2);
$highwayStyle2 = new styleObj($highwayClass); 
$highwayStyle2-color-setRGB(254,173,0);
$highwayStyle2-set('linecap','square'); 
$highwayStyle2-set('width',4);
$respdorStyle2-outlinecolor-setRGB(255,0,0); 
$respdorStyle2-set('outlinewidth',2);

-

Result when order by id asc:
http://s22.postimg.org/esbobf18x/order_by_id_asc.jpg

Result when order by id desc:
http://s10.postimg.org/qeokp2jrd/order_by_id_desc.jpg

-
That's the goods for me but there is the impression of using some undocumented 
singularity.
Thanx for any comments.




___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] [EXTERNAL] Re: the lines one above other

2015-02-13 Thread Eichner, Andreas - SID
 It seems I found how to display multilevel junction of highway with ORDER
 BY in the case using a one layer. Adding order by id desc or order by
 id asc in subquery
 
 $highwayLayer-set(data,geom from (select id, 'id = '||id as name, geom
 from my_table
 where ST_Intersects(geom, !BOX!) order by id desc) as subquery using
 unique id using srid=3857);

Be careful with that as you cannot expect this to work consistently as long as 
MapServer wraps it in a subquery. The database will likely return your features 
either in storage order or in index order depending if it uses a sequential 
scan or the index. You should not rely on an ORDER BY within a subquery...
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] [EXTERNAL] Re: the lines one above other

2015-02-13 Thread thomas bonfort
You can do it in a single layer, provided that you have someway of
determining via attributes that a given road segment isn't connected
to other road segments below it (typically that would be something
saying it's a bridge rather than a regular road). The behavior is
undocumented and relies on the knowledge of how mapserver treats the
line cache for casing.

CLASS
  EXPRESSION ([type]=bridge)
  STYLE
  END
  STYLE
WIDTH 5
COLOR bridge_outline_color
LINECAP butt
  END
  STYLE
WIDTH 3
COLOR highway_color
  END
END
CLASS
  STYLE
WIDTH 5
COLOR highway_outline_color
  END
  STYLE
WIDTH 3
COLOR highway_color
  END
END

(The trick is to add an empty style block so the rendering order for
bridges is offset by one compared to normal roads)

In your sql query, you also use an order by z_level asc so higher
roads get drawn after (=over) lower ones.
You might want to take a look at https://github.com/mapserver/basemaps
where this (along with other tricks for dealing with complex road
maps) is used.

--
thomas

On 13 February 2015 at 07:52, Vladimir f...@inbox.ru wrote:
 I would draw your attention to the source of this discussion.
 http://osgeo-org.1560.x6.nabble.com/the-lines-one-above-other-td5187093.html

 It seems I found how to display multilevel junction of highway with ORDER
 BY in the case using a one layer. Adding order by id desc or order by id
 asc in subquery, also the definition $highwayStyle2 besides $highwayStyle1
 works fine.
 Please see the code and the illustrations below:

 --

 $highwayLayer-set('status', MS_ON);
 $highwayLayer-set('name', 'highway');
 $highwayLayer-set('labelitem', 'name');
 $highwayLayer-setConnectionType(MS_POSTGIS);
 $highwayLayer-set('connection', 'user=my_user password=my_pass dbname=my_db
 host=localhost');

 $highwayLayer-set(data,geom from (select id, 'id = '||id as name, geom
 from my_table
 where ST_Intersects(geom, !BOX!) order by id desc) as subquery using unique
 id using srid=3857);
 $highwayLayer-setprocessing(close_connection=defer);
 $highwayLayer-set(type,MS_LAYER_LINE);

 $highwayClass = new ClassObj($highwayLayer);
 $highwayClass-set('name', 'highway');

 $highwayStyle1 = new styleObj($highwayClass);
 $highwayStyle1-color-setRGB(254,173,0);
 $highwayStyle1-set('linecap','square');
 $highwayStyle1-set('width',4);
 $respdorStyle1-outlinecolor-setRGB(255,0,0);
 $respdorStyle1-set('outlinewidth',2);

 $highwayStyle2 = new styleObj($highwayClass);
 $highwayStyle2-color-setRGB(254,173,0);
 $highwayStyle2-set('linecap','square');
 $highwayStyle2-set('width',4);
 $respdorStyle2-outlinecolor-setRGB(255,0,0);
 $respdorStyle2-set('outlinewidth',2);

 -

 Result when order by id asc:
 http://s22.postimg.org/esbobf18x/order_by_id_asc.jpg

 Result when order by id desc:
 http://s10.postimg.org/qeokp2jrd/order_by_id_desc.jpg

 -

 That's the goods for me but there is the impression of using some
 undocumented singularity.

 Thanx for any comments.






 ___
 mapserver-users mailing list
 mapserver-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapserver-users
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] [EXTERNAL] Re: the lines one above other

2015-02-12 Thread Smith, Michael ERDC-RDE-CRREL-NH
This is also not an issue in Oracle.

M

On 2/12/15, 8:55 AM, thomas bonfort thomas.bonf...@gmail.com wrote:

Actually there is an issue opened for this, as the order by inside the
subquery is not guaranteed to be maintained in the outer query:
https://github.com/mapserver/mapserver/issues/5008 . For mssql there
has been a patch applied, for postgis it is not needed yet.

On 12 February 2015 at 08:48, Smith, Michael ERDC-RDE-CRREL-NH
michael.sm...@erdc.dren.mil wrote:
 No, MapServer respects the feature order. Using the ORDER BY with a
 database connection, MapServer will draw features in that order.

 Mike

 --
 Michael Smith

 US Army Corps
 Remote Sensing GIS/Center



 On 2/12/15, 7:52 AM, Eichner, Andreas - SID
 andreas.eich...@sid.sachsen.de wrote:

I'm not sure about this but AFAIK MapServer draws features in the order
they are returned by the query. For Shapefiles there is the sortshp
utility. If you're on a relational database like PostGIS or
OracleSpatial
you can try including the ORDER BY prio within the DATA. But since MS
wraps it into a subquery the database might still return the features
out
of order.

 -Ursprüngliche Nachricht-
 Von: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-
 boun...@lists.osgeo.org] Im Auftrag von Vladimir
 Gesendet: Donnerstag, 12. Februar 2015 12:02
 An: mapserver-users@lists.osgeo.org
 Betreff: [mapserver-users] the lines one above other

 Hello All!



 The task is to show multilevel junction of highway.
 The lines should be at the same layer and has the same style, for
example
 see orange lines on attached pic:
 [img]http://s14.postimg.org/yk40e0nq9/crossroad.jpg[/img]
 Is it possible to draw the lines one above other by an one layer?
 May be some method of Z-index for features in a layer exists?
 Thanks for any guidance to display this kind of crossroads.

 Vladimir
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

 ___
 mapserver-users mailing list
 mapserver-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapserver-users

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] [EXTERNAL] Re: the lines one above other

2015-02-12 Thread Smith, Michael ERDC-RDE-CRREL-NH
No, MapServer respects the feature order. Using the ORDER BY with a
database connection, MapServer will draw features in that order.

Mike

-- 
Michael Smith

US Army Corps
Remote Sensing GIS/Center



On 2/12/15, 7:52 AM, Eichner, Andreas - SID
andreas.eich...@sid.sachsen.de wrote:

I'm not sure about this but AFAIK MapServer draws features in the order
they are returned by the query. For Shapefiles there is the sortshp
utility. If you're on a relational database like PostGIS or OracleSpatial
you can try including the ORDER BY prio within the DATA. But since MS
wraps it into a subquery the database might still return the features out
of order. 

 -Ursprüngliche Nachricht-
 Von: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-
 boun...@lists.osgeo.org] Im Auftrag von Vladimir
 Gesendet: Donnerstag, 12. Februar 2015 12:02
 An: mapserver-users@lists.osgeo.org
 Betreff: [mapserver-users] the lines one above other
 
 Hello All!
 
 
 
 The task is to show multilevel junction of highway.
 The lines should be at the same layer and has the same style, for
example
 see orange lines on attached pic:
 [img]http://s14.postimg.org/yk40e0nq9/crossroad.jpg[/img]
 Is it possible to draw the lines one above other by an one layer?
 May be some method of Z-index for features in a layer exists?
 Thanks for any guidance to display this kind of crossroads.
 
 Vladimir
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] [EXTERNAL] Re: the lines one above other

2015-02-12 Thread thomas bonfort
Actually there is an issue opened for this, as the order by inside the
subquery is not guaranteed to be maintained in the outer query:
https://github.com/mapserver/mapserver/issues/5008 . For mssql there
has been a patch applied, for postgis it is not needed yet.

On 12 February 2015 at 08:48, Smith, Michael ERDC-RDE-CRREL-NH
michael.sm...@erdc.dren.mil wrote:
 No, MapServer respects the feature order. Using the ORDER BY with a
 database connection, MapServer will draw features in that order.

 Mike

 --
 Michael Smith

 US Army Corps
 Remote Sensing GIS/Center



 On 2/12/15, 7:52 AM, Eichner, Andreas - SID
 andreas.eich...@sid.sachsen.de wrote:

I'm not sure about this but AFAIK MapServer draws features in the order
they are returned by the query. For Shapefiles there is the sortshp
utility. If you're on a relational database like PostGIS or OracleSpatial
you can try including the ORDER BY prio within the DATA. But since MS
wraps it into a subquery the database might still return the features out
of order.

 -Ursprüngliche Nachricht-
 Von: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-
 boun...@lists.osgeo.org] Im Auftrag von Vladimir
 Gesendet: Donnerstag, 12. Februar 2015 12:02
 An: mapserver-users@lists.osgeo.org
 Betreff: [mapserver-users] the lines one above other

 Hello All!



 The task is to show multilevel junction of highway.
 The lines should be at the same layer and has the same style, for
example
 see orange lines on attached pic:
 [img]http://s14.postimg.org/yk40e0nq9/crossroad.jpg[/img]
 Is it possible to draw the lines one above other by an one layer?
 May be some method of Z-index for features in a layer exists?
 Thanks for any guidance to display this kind of crossroads.

 Vladimir
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

 ___
 mapserver-users mailing list
 mapserver-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapserver-users
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users