[mapserver-users] Arc symbol.

2019-03-05 Thread Marek Bąk

Hello All,

Is it possible to create an arc symbol im mapserver? For example I have 
two lines constructed over some angle (ex. 30 degree) and I want to draw 
an arc between them.


Regards,

Marek


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

Re: [mapserver-users] Arc symbol.

2019-03-05 Thread Lime, Steve D (MNIT)
Not within MapServer directly, at least not at first glance. There are circle 
layers but there’s no way to limit drawing to just a specific arc on that 
circle. Here are some other ideas:


1)  Perhaps it could be done externally in OGR or PostGIS and then rendered 
in MapServer as a polygon or a line…

2)  You could also take a look at using javascript geotransformations: 
https://mapserver.org/mapfile/geomtransform.html#javascript-transformation 
Support was added a while back and isn’t widely used but this is the sort of 
thing it was added for. In theory you should be able to compute the arc 
yourself and return it for rendering. So you pass in the 2 lines and then 
return the arc as a line shape or a pie slice as a polygon shape. (maybe this 
helps… 
https://stackoverflow.com/questions/45009327/draw-arc-between-two-lines-i-need-to-calculate-points)

If option 2 works this would be a great thing to archive – a library of 
geomtranforms. I might tinker with this tonight… ;-)

--Steve

From: mapserver-users [mailto:mapserver-users-boun...@lists.osgeo.org] On 
Behalf Of Marek Bak
Sent: Tuesday, March 05, 2019 1:27 PM
To: mapserver-users@lists.osgeo.org
Subject: [mapserver-users] Arc symbol.


Hello All,

Is it possible to create an arc symbol im mapserver? For example I have two 
lines constructed over some angle (ex. 30 degree) and I want to draw an arc 
between them.

Regards,

Marek


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

Re: [mapserver-users] Arc symbol.

2019-03-06 Thread Seth G
Hi Marek,

I had a similar question last year - 
http://osgeo-org.1560.x6.nabble.com/Curves-in-MapServer-td5377180.html

You can add/draw CIRCULARSTRING geometries to MapServer using OGR - see the 
sample rainbow image at https://github.com/geographika/mappyfile-colors

The sample map file is: 
https://raw.githubusercontent.com/geographika/mappyfile-colors/master/example.map
This loads the following curved arcs from 
https://github.com/geographika/mappyfile-colors/blob/master/curves.csv

CONNECTIONTYPE OGR has to be used rather than using inline features as this 
approach defaults to using GEOS which doesn't support curves, whereas as 
forcing OGR does. 

Seth

--
web:http://geographika.co.uk
twitter: @geographika


On Wed, Mar 6, 2019, at 12:31 AM, Lime, Steve D (MNIT) wrote:
> Not within MapServer directly, at least not at first glance. There are circle 
> layers but there’s no way to limit drawing to just a specific arc on that 
> circle. Here are some other ideas:

> 

> 1) Perhaps it could be done externally in OGR or PostGIS and then rendered in 
> MapServer as a polygon or a line…

> 2) You could also take a look at using javascript geotransformations:  
> https://mapserver.org/mapfile/geomtransform.html#javascript-transformation 
> Support was added a while back and isn’t widely used but this is the sort of 
> thing it was added for. In theory you should be able to compute the arc 
> yourself and return it for rendering. So you pass in the 2 lines and then 
> return the arc as a line shape or a pie slice as a polygon shape. (maybe this 
> helps… 
> https://stackoverflow.com/questions/45009327/draw-arc-between-two-lines-i-need-to-calculate-points)

> 

> If option 2 works this would be a great thing to archive – a library of 
> geomtranforms. I might tinker with this tonight… ;-)

> 

> --Steve

> 

> *From:* mapserver-users [mailto:mapserver-users-boun...@lists.osgeo.org] *On 
> Behalf Of *Marek Bak
> *Sent:* Tuesday, March 05, 2019 1:27 PM
> *To:* mapserver-users@lists.osgeo.org
> *Subject:* [mapserver-users] Arc symbol.

> 

> Hello All,

> Is it possible to create an arc symbol im mapserver? For example I have two 
> lines constructed over some angle (ex. 30 degree) and I want to draw an arc 
> between them.

> Regards,

> Marek

> 

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

Re: [mapserver-users] Arc symbol.

2019-03-06 Thread Basques, Bob (CI-StPaul)
Marek,

Landing your data into Postgres/PostGIS enables a bunch of capabilities.  
Combined with MapServer as an output/convertor, you can essentially filter to 
your hearts content as well as reproject to just about any EPSG code with Ease. 
 We’ve even added to the EPSG lists in PostGIS for our own, custom local 
coordinate system.

The benefits of using Postgis as a data staging (caching) area far outweigh the 
extra effort of adding the data in.

bobb



On Mar 5, 2019, at 2:30 PM, Marek Bąk 
mailto:rai...@poczta.onet.pl>> wrote:

Hello Bob,

It is not about data (the customer delivered data). It is about visualization. 
I have object to visualize - point (lat, lon) with degree range (min degree, 
max degree). The end user should see that object as an arc. There is support 
for ellipse/circle in mapserver SYMBOL but I did not found simply way to draw 
just part of cirle.

Regards,
Marek


W dniu 2019-03-05 o 20:49, Basques, Bob (CI-StPaul) pisze:
This is related more to what type of data you want/need to save the data in.  
Not all data formats understand Arc definitions.  Postgres for example does, as 
does AutoCAD (DXF).  The ESRI Rest services can (but I think it needs to be 
turned on from the server side.

bobb



On Mar 5, 2019, at 1:26 PM, Marek Bąk 
mailto:rai...@poczta.onet.pl>> wrote:


Hello All,

Is it possible to create an arc symbol im mapserver? For example I have two 
lines constructed over some angle (ex. 30 degree) and I want to draw an arc 
between them.

Regards,

Marek


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



Work like you don’t need money, love like you’ve never been hurt, and dance 
like no one’s watching
—Unknown Author





"A rocket will never be able to leave the earth's atmosphere."  --The New York 
Times, 1936

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

Re: [mapserver-users] Arc symbol.

2019-03-06 Thread lars . schylberg
Hi Marek,

This is a way of making arcs in Mapserver that is based on using VRTs and sql
The data source doesn't need to be in spatialite though. It can be a shapefile
or a CSV file or anything that gdal can handle.

Simon Mercier at Mapgears and I developed this for making litehouse circles
for Sea charts a couple of years ago. In the current version of the
SMAC-M project this is done with preprocessing in another way.

But I still like the idea that You can draw anything with sql.

I was going to make a small separate example this morning.
But I ran into some problems. It seems like my current gdal is not
compiled with a version of libspatialite that should use
librttopo instead of the lwgeom. In the version I used before I had the
sql function ST_project. In the version I had today on my machine and in some 
docker
containers I didn't. I guess I have to build a gdal-mapserver with
the right libspatialite and librttopo versions where I can do
these trix again some time.

Anyway this is the VRT file that can draw an arc in Mapserver.
The data source contains points in EPSG 4326 and we are drawing the arc
in EPSG 3857 in this case. valnmr is the radius and sectr1 and sectr2 are
starting and ending angles of the arc.

To use the vrt in mapserver you use:

 CONNECTION "arc.vrt"
 CONNECTIONTYPE OGR
 DATA "arc"

## arc.vrt #

 coastal.sqlite
 
 SELECT rcid,fidn,valnmr,sectr1,sectr2,colour,SIGGRP,SIGPER,HEIGHT,
 MakeArc(ST_X(Transform(Geometry,3857)),ST_Y(Transform(Geometry,3857)),
 GLength(Transform(MakeLine( MakePoint( X(Geometry), Y(Geometry),4326),
 ST_Project( MakePoint( X(Geometry), Y(Geometry), 4326 ),
 valnmr*1852/10, Radians( sectr1-180 ))),3857)),
 (180-(sectr2-90)),(180-(sectr1-90)),3857,2) AS geometry
 FROM lights_point
 WHERE sectr1 NOT NULL AND sectr2 NOT NULL AND sectr1!=0 AND sectr2!=360
 

###

If You would like to check what version of various libraries that You
have, You can use this VRT and run ogrinfo on it. E.g ogrinfo debug.vrt debug

# debug.vrt #
 
 
 coastal.sqlite
 
 select
 sqlite_version(),
 spatialite_version(),
 lwgeom_version(),
 geos_version(),
 proj4_version()
 FROM lights_point
 
 
# 

Have fun !

Lars Schylberg
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] Arc symbol.

2019-03-12 Thread Marek Bąk

Hi All,

Thanks for all suggestions and ideas. I've evaluated them using the ms4w 
binaries (v3.3.0):

- there is no support for V8 at the moment (unless built from sources),
- adding ST_Project to spatialite library is on roadmap (at the moment 
you need to compile spatialite library yourself),
- I failed with CIRCULARSTRING - when I used select with ST_GeomFromText 
and CIRCULARSTRING as geometry the result was null (I guess that I've 
missed something),
/- /I did not test PostGIS but I think that it should work (I guess all 
required function are there).


Instead of all above, since I'm working on S-57 LIGHTS layer and I've 
already needed a shape file for storing each light description, I've 
decided to convert S-57 ENC LIGHTS layer to two shape files (one for 
POINTS and one for LINES). I still need to tweak that solution but it 
seems to work (one layer became physically two but since I'm using GROUP 
attribute in LAYER object logically it was one to one conversion).


Regards,
Marek



Hi Marek,

This is a way of making arcs in Mapserver that is based on using VRTs 
and sql
The data source doesn't need to be in spatialite though. It can be a 
shapefile

or a CSV file or anything that gdal can handle.

Simon Mercier at Mapgears and I developed this for making litehouse 
circles

for Sea charts a couple of years ago. In the current version of the
SMAC-M project this is done with preprocessing in another way.

But I still like the idea that You can draw anything with sql.

I was going to make a small separate example this morning.
But I ran into some problems. It seems like my current gdal is not
compiled with a version of libspatialite that should use
librttopo instead of the lwgeom. In the version I used before I had the
sql function ST_project. In the version I had today on my machine and 
in some docker

containers I didn't. I guess I have to build a gdal-mapserver with
the right libspatialite and librttopo versions where I can do
these trix again some time.

Anyway this is the VRT file that can draw an arc in Mapserver.
The data source contains points in EPSG 4326 and we are drawing the arc
in EPSG 3857 in this case. valnmr is the radius and sectr1 and sectr2 are
starting and ending angles of the arc.

To use the vrt in mapserver you use:

CONNECTION "arc.vrt"
CONNECTIONTYPE OGR
DATA "arc"

## arc.vrt #

coastal.sqlite

SELECT rcid,fidn,valnmr,sectr1,sectr2,colour,SIGGRP,SIGPER,HEIGHT,
MakeArc(ST_X(Transform(Geometry,3857)),ST_Y(Transform(Geometry,3857)),
GLength(Transform(MakeLine( MakePoint( X(Geometry), Y(Geometry),4326),
ST_Project( MakePoint( X(Geometry), Y(Geometry), 4326 ),
valnmr*1852/10, Radians( sectr1-180 ))),3857)),
(180-(sectr2-90)),(180-(sectr1-90)),3857,2) AS geometry
FROM lights_point
WHERE sectr1 NOT NULL AND sectr2 NOT NULL AND sectr1!=0 AND sectr2!=360


###

If You would like to check what version of various libraries that You
have, You can use this VRT and run ogrinfo on it. E.g ogrinfo 
debug.vrt debug


# debug.vrt #


coastal.sqlite

select
sqlite_version(),
spatialite_version(),
lwgeom_version(),
geos_version(),
proj4_version()
FROM lights_point


#

Have fun !

Lars Schylberg



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

Re: [mapserver-users] Arc symbol.

2019-03-12 Thread lars . schylberg
Hi again Marek,

I You are doing S-57 LÍGHTS layer. That is exacly what we are doing in the 
SMAC-M project: https://github.com/LarsSchy/SMAC-M 
(https://github.com/LarsSchy/SMAC-M)
We have a solution for doing S-57 charts with Mapserver. Both preparing data 
and generate mapfiles.

Your specific question is solved with the preprocessing step in: 
https://github.com/LarsSchy/SMAC-M/blob/master/chart-installation/data_files_conversion/shp_s57data/generate_light_sector.py
  
(https://github.com/LarsSchy/SMAC-M/blob/master/chart-installation/data_files_conversion/shp_s57data/generate_light_sector.py)

Best regards

Lars Schylberg
March 12, 2019 6:17 PM, "Marek Bąk" mailto:rai...@poczta.onet.pl?to=%22Marek%20B%C4%85k%22%20)>
 wrote:
Hi All, 
Thanks for all suggestions and ideas. I've evaluated them using the ms4w 
binaries (v3.3.0): 
- there is no support for V8 at the moment (unless built from sources), 
- adding ST_Project to spatialite library is on roadmap (at the moment you need 
to compile spatialite library yourself), 
- I failed with CIRCULARSTRING - when I used select with ST_GeomFromText and 
CIRCULARSTRING as geometry the result was null (I guess that I've missed 
something),  
- I did not test PostGIS but I think that it should work (I guess all required 
function are there). 
Instead of all above, since I'm working on S-57 LIGHTS layer and I've already 
needed a shape file for storing each light description, I've decided to convert 
S-57 ENC LIGHTS layer to two shape files (one for POINTS and one for LINES). I 
still need to tweak that solution but it seems to work (one layer became 
physically two but since I'm using GROUP attribute in LAYER object logically it 
was one to one conversion). 
Regards, 
Marek 
 Hi Marek,

This is a way of making arcs in Mapserver that is based on using VRTs and sql
The data source doesn't need to be in spatialite though. It can be a shapefile
or a CSV file or anything that gdal can handle.

Simon Mercier at Mapgears and I developed this for making litehouse circles
for Sea charts a couple of years ago. In the current version of the
SMAC-M project this is done with preprocessing in another way.

But I still like the idea that You can draw anything with sql.

I was going to make a small separate example this morning.
But I ran into some problems. It seems like my current gdal is not
compiled with a version of libspatialite that should use
librttopo instead of the lwgeom. In the version I used before I had the
sql function ST_project. In the version I had today on my machine and in some 
docker
containers I didn't. I guess I have to build a gdal-mapserver with
the right libspatialite and librttopo versions where I can do
these trix again some time.

Anyway this is the VRT file that can draw an arc in Mapserver.
The data source contains points in EPSG 4326 and we are drawing the arc
in EPSG 3857 in this case. valnmr is the radius and sectr1 and sectr2 are
starting and ending angles of the arc.

To use the vrt in mapserver you use:

CONNECTION "arc.vrt"
CONNECTIONTYPE OGR
DATA "arc"

## arc.vrt #

coastal.sqlite

SELECT rcid,fidn,valnmr,sectr1,sectr2,colour,SIGGRP,SIGPER,HEIGHT,
MakeArc(ST_X(Transform(Geometry,3857)),ST_Y(Transform(Geometry,3857)),
GLength(Transform(MakeLine( MakePoint( X(Geometry), Y(Geometry),4326),
ST_Project( MakePoint( X(Geometry), Y(Geometry), 4326 ),
valnmr*1852/10, Radians( sectr1-180 ))),3857)),
(180-(sectr2-90)),(180-(sectr1-90)),3857,2) AS geometry
FROM lights_point
WHERE sectr1 NOT NULL AND sectr2 NOT NULL AND sectr1!=0 AND sectr2!=360


###

If You would like to check what version of various libraries that You
have, You can use this VRT and run ogrinfo on it. E.g ogrinfo debug.vrt debug

# debug.vrt #


coastal.sqlite

select
sqlite_version(),
spatialite_version(),
lwgeom_version(),
geos_version(),
proj4_version()
FROM lights_point


#

Have fun !

Lars Schylberg
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users