[MapServer-users] mapserver union layer of type chart

2024-06-07 Thread Zmitser Kozhukh via MapServer-users

 
Hello,
 
just  wondering weather it is possible to have union (by connectiontype) layer 
of type chart? 
Yesterday I have tried, but each time got an empty image.
 
Configuration looks like:
 
LAYER
  NAME union_layer_name
  TYPE         CHART
  #PROCESSING "CHART_TYPE=pie"
  #PROCESSING "CHART_SIZE_RANGE=c 30 100 2 200 5"
  PROCESSING "ITEMS=province,c,n,y,ts,level_code"
  STYLEITEM "AUTO"
  STATUS DEFAULT
  CONNECTIONTYPE UNION
  CONNECTION "layer1,layer2 etc."
  METADATA
      ows_title         "name"
      ows_include_items '*'
      gml_include_items "all"
      gml_geom_type "point"
      ows_enable_request '*'
      "wms_timeextent" 
"2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023"
      "wms_timeitem" "ts"
      "wms_timedefault" "2009"
  END
  
  PROJECTION
    "init=epsg:4326"
  END
  
  VALIDATION
    'time' '[0-9]{4}'
    'default_time' '2009'
  END
  
    CLASS 
    END
  
  END
  
LAYER 
    NAME  layer1
    CONNECTIONTYPE POSTGIS
    CONNECTION "host=x dbname=x user=x password=x"
    DATA "geom_p from (... )   foo using unique province using srid=4326"
    
    STATUS       ON
    TYPE         CHART
    PROCESSING "CHART_TYPE=pie"
    PROCESSING "CHART_SIZE_RANGE=c 30 100 2 200 5"
    STATUS ON
    PROCESSING "LABEL_NO_CLIP=True"
    
    PROJECTION
      "init=epsg:4326"
    END
    
    VALIDATION
    'time' '[0-9]{4}'
    'default_time' '2009'
    END
    
    METADATA
      wms_title "layer 1"
      gml_include_items "all"
      gml_geom_type "point"
      ows_include_items  "all"
      ows_enable_request "*"
      "wms_timeextent" 
"2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023"
      "wms_timeitem" "ts"
      "wms_timedefault" "2009"
    END
    
    MAXSCALEDENOM 1001
    MINSCALEDENOM 121
 
    FILTER ([level_code]=1)
    
etc...
 
If I uncomment these lines in union layer:
  #PROCESSING "CHART_TYPE=pie"
  #PROCESSING "CHART_SIZE_RANGE=c 30 100 2 200 5"
 
This works but returns an empty image. And if these lines are not there , 
mapserver breaks with internal error.
 
I have looked briefly through documentation but nowhere was mentioned that 
union layer doesn’t support type chart, so maybe there is something missing in 
my mapfile.
 
Another thing is that may be there are other better option for me rather than 
using union layer. The thing is that I would like to draw map charts for 
different administrative units based on map scales, let’s say if I am in small 
map scale to draw chart for the country, if I zoom in — for district, and if I 
zoom further — for municipality. I have tried to keep it all in one layer of 
type chart and use this type of class definitions:
class
expression ([level_code]=1)
minscaledenom 100
maxscaledenom 50
…..
 
But it didn’t  work — apparently in layer of type chart keyword expression is 
not used in the same way as in other layers.
So,  would be grateful if someone could help me with this.
 
Sincerely, Zmitser
 
 
 
--
Zmitser Kozhukh___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] data parameter in tileindex

2021-03-24 Thread Zmitser Kozhukh via mapserver-users

Thank you very much, Edward, for the suggestion. But I use tiles of vector 
data. And currently the problem is how to put postgis connection and data 
parameter in one (so that mapserver parses it correctly from location column of 
tileindex) .
With best regards, Zmitser

  
>Среда, 24 марта 2021, 10:45 +03:00 от Edward Mac Gillavry 
>:
> 
>Zmister,
> 
>Check out the GH repo of the Amsterdam municipality. The MAP-file for 2020 is 
>at  https://github.com/Amsterdam/mapserver/blob/master/lufo2020.map  where you 
>can see the DATA connection to the Shape file that holds the tile index. The 
>Shape files for the various years are in the folder  
>https://github.com/Amsterdam/mapserver/tree/master/luchtfoto . These were 
>created using  gdaltindex  as you can see in the bash script at  
>https://github.com/Amsterdam/mapserver/blob/master/lufopyramids.sh . That's 
>where you pass the location of the GeoTIFFs to populate the column in the 
>Shape files so MapServer can open the required GeoTIFFs to generate an image  
>Hopefully these practical examples guide you.
> 
>Best,
> 
>Edward
> 
> 
> 
> 
>Outlook voor Android downloaden
>--
>From: mapserver-users < mapserver-users-boun...@lists.osgeo.org > on behalf of 
>Zmitser Kozhukh via mapserver-users < mapserver-users@lists.osgeo.org >
>Sent: Wednesday, March 24, 2021 8:02:45 AM
>To: Carlos Ruiz < boolean10...@yahoo.com >
>Cc: mapserver-users@lists.osgeo.org < mapserver-users@lists.osgeo.org >
>Subject: Re: [mapserver-users] data parameter in tileindex
> 
>Dear Carlos, it is not about mapfile, it is in location cell of tileindex. It 
>is one cell in table (database table, dbf file etc.), and I need to put there 
>both connection and data details. The question is how to make it so that 
>mapserver parses it correctly.
>Sincerely, Zmitser   
>>Среда, 24 марта 2021, 6:53 +03:00 от Carlos Ruiz < boolean10...@yahoo.com >:
>>  
>>Zmitser,
>> 
>>You have to have the following on a MAP file:
>> 
>>LAYER
>> 
>>...
>> 
>>CONNECTION "host= ... password="
>>CONNECTIONTYPE 
>>DATA " FROM  USING UNIQUE  USING SRID="
>> 
>>...
>> 
>>END
>> 
>>On DATA you must specify the name of the geometry column and the table, if 
>>you're using a database. If you are using a shape file you just have to 
>>include the DATA keyword with the path and the name of the SHP file.
>> 
>> 
>>On Tuesday, March 23, 2021, 2:34:48 AM CST, Zmitser Kozhukh via 
>>mapserver-users < mapserver-users@lists.osgeo.org > wrote:
>> 
>> 
>>Dear mapserver users, I need to specify data parameter at the location item 
>>of tileindex.
>>So far, I have tried many possibilities but none works:
>>‘host=127.0.0.1 dbname=database user=admin password=admin DATA "geom from 
>>table using unique id using srid=4326"’
>>or
>>host=127.0.0.1 dbname=database user=admin password=admin data="geom from 
>>table using unique id using srid=4326"
>>etc.
>>Still I get an error :
>>msDrawMap(): Image handling error. Failed to draw layer named 'layer'. 
>>msPostGISLayerOpen(): Query error. Nothing specified in DATA statement.
>>Could someone please tell in which format data statement should be?
>>In documentation it is written vaguely:
>>Normally the location should contain the path to the tile file relative to 
>>the shapepath, not relative to the tileindex itself. If the DATA parameter 
>>contains a value then it is added to the end of the location.
>> 
>>--
>>Zmitser Kozhukh ___
>>mapserver-users mailing list
>>mapserver-users@lists.osgeo.org
>>https://lists.osgeo.org/mailman/listinfo/mapserver-users 
> 
> 
>--
>Zmitser Kozhukh
>  
 
 
--
Zmitser Kozhukh
 ___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] data parameter in tileindex

2021-03-24 Thread Zmitser Kozhukh via mapserver-users

Dear Jukka, you right with OGR it works. If I type something like:
"PG:"dbname=database host=127.0.0.1 port=5432 user=admin password=admin 
tables=objects_in_countryA(geom)""
It works. Because for OGR layer types, providing connection is enough.
But for PostGIS , also the data part need to be provided separately.
In fact , it is just a matter of interest for me. What will be faster , have it 
with OGR PostGIS driver or with native mapserver postgis driver (I assume if 
type of connection PostGIS mapserver uses its own driver for reading features).
I will let you know after I find out the way.
Sincerely, Zmitser
>Среда, 24 марта 2021, 10:43 +03:00 от Rahkonen Jukka (MML) 
>:
> 
>Hi,
> 
>Obviously you are playing with vector data, not rasters, and you are trying to 
>make a ogrtileindex instead of gdaltindex. I know, technically there is no 
>difference.
> 
>I have used ogrtileindex with great success with shapefiles. I have never 
>tried to do the same with PostGIS data and I can only wish you luck with your 
>experiments. One thing that came into my mind it that perhaps OGR connection 
>to PostGIS would work better than the native one with tileindex.
> 
>-Jukka Rahkonen-
> 
>Lähettäjä: mapserver-users < mapserver-users-boun...@lists.osgeo.org >  
>Puolesta  Zmitser Kozhukh via mapserver-users
>Lähetetty: keskiviikko 24. maaliskuuta 2021 9.03
>Vastaanottaja: Carlos Ruiz < boolean10...@yahoo.com >
>Kopio: mapserver-users@lists.osgeo.org
>Aihe: Re: [mapserver-users] data parameter in tileindex
> 
>Dear Carlos, it is not about mapfile, it is in location cell of tileindex. It 
>is one cell in table (database table, dbf file etc.), and I need to put there 
>both connection and data details. The question is how to make it so that 
>mapserver parses it correctly.
>Sincerely, Zmitser
> 
>>Среда, 24 марта 2021, 6:53 +03:00 от Carlos Ruiz < boolean10...@yahoo.com >:
>> 
>>Zmitser,
>> 
>>You have to have the following on a MAP file:
>> 
>>LAYER
>> 
>>...
>> 
>>CONNECTION "host= ... password="
>>CONNECTIONTYPE 
>>DATA " FROM  USING UNIQUE  USING SRID="
>> 
>>...
>> 
>>END
>> 
>>On DATA you must specify the name of the geometry column and the table, if 
>>you're using a database. If you are using a shape file you just have to 
>>include the DATA keyword with the path and the name of the SHP file.
>> 
>> 
>>On Tuesday, March 23, 2021, 2:34:48 AM CST, Zmitser Kozhukh via 
>>mapserver-users < mapserver-users@lists.osgeo.org > wrote:
>> 
>> 
>>Dear mapserver users, I need to specify data parameter at the location item 
>>of tileindex.
>>So far, I have tried many possibilities but none works:
>>‘host=127.0.0.1 dbname=database user=admin password=admin DATA "geom from 
>>table using unique id using srid=4326"’
>>or
>>host=127.0.0.1 dbname=database user=admin password=admin data="geom from 
>>table using unique id using srid=4326"
>>etc.
>>Still I get an error :
>>msDrawMap(): Image handling error. Failed to draw layer named 'layer'. 
>>msPostGISLayerOpen(): Query error. Nothing specified in DATA statement.
>>Could someone please tell in which format data statement should be?
>>In documentation it is written vaguely:
>>Normally the location should contain the path to the tile file relative to 
>>the shapepath, not relative to the tileindex itself. If the DATA parameter 
>>contains a value then it is added to the end of the location.
>> 
>>--
>>Zmitser Kozhukh
>>___
>>mapserver-users mailing list
>>mapserver-users@lists.osgeo.org
>>https://lists.osgeo.org/mailman/listinfo/mapserver-users
> 
> 
>--
>Zmitser Kozhukh
>  
 
 
--
Zmitser Kozhukh
 ___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] data parameter in tileindex

2021-03-24 Thread Zmitser Kozhukh via mapserver-users

Dear Carlos, it is not about mapfile, it is in location cell of tileindex. It 
is one cell in table (database table, dbf file etc.), and I need to put there 
both connection and data details. The question is how to make it so that 
mapserver parses it correctly.
Sincerely, Zmitser
>Среда, 24 марта 2021, 6:53 +03:00 от Carlos Ruiz :
> 
>Zmitser,
> 
>You have to have the following on a MAP file:
> 
>LAYER
> 
>...
> 
>CONNECTION "host= ... password="
>CONNECTIONTYPE 
>DATA " FROM  USING UNIQUE  USING SRID="
> 
>...
> 
>END
> 
>On DATA you must specify the name of the geometry column and the table, if 
>you're using a database. If you are using a shape file you just have to 
>include the DATA keyword with the path and the name of the SHP file.
> 
> 
>On Tuesday, March 23, 2021, 2:34:48 AM CST, Zmitser Kozhukh via 
>mapserver-users < mapserver-users@lists.osgeo.org > wrote:
> 
> 
>Dear mapserver users, I need to specify data parameter at the location item of 
>tileindex.
>So far, I have tried many possibilities but none works:
>‘host=127.0.0.1 dbname=database user=admin password=admin DATA "geom from 
>table using unique id using srid=4326"’
>or
>host=127.0.0.1 dbname=database user=admin password=admin data="geom from table 
>using unique id using srid=4326"
>etc.
>Still I get an error :
>msDrawMap(): Image handling error. Failed to draw layer named 'layer'. 
>msPostGISLayerOpen(): Query error. Nothing specified in DATA statement.
>Could someone please tell in which format data statement should be?
>In documentation it is written vaguely:
>Normally the location should contain the path to the tile file relative to the 
>shapepath, not relative to the tileindex itself. If the DATA parameter 
>contains a value then it is added to the end of the location.
> 
>--
>Zmitser Kozhukh ___
>mapserver-users mailing list
>mapserver-users@lists.osgeo.org
>https://lists.osgeo.org/mailman/listinfo/mapserver-users 
 
 
--
Zmitser Kozhukh
 ___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] data parameter in tileindex

2021-03-23 Thread Zmitser Kozhukh via mapserver-users

Dear mapserver users, I need to specify data parameter at the location item of 
tileindex.
So far, I have tried many possibilities but none works:
‘host=127.0.0.1 dbname=database user=admin password=admin DATA "geom from table 
using unique id using srid=4326"’
or
host=127.0.0.1 dbname=database user=admin password=admin data="geom from table 
using unique id using srid=4326"
etc.
Still I get an error :
msDrawMap(): Image handling error. Failed to draw layer named 'layer'. 
msPostGISLayerOpen(): Query error. Nothing specified in DATA statement.
Could someone please tell in which format data statement should be?
In documentation it is written vaguely:
Normally the location should contain the path to the tile file relative to the 
shapepath, not relative to the tileindex itself. If the DATA parameter contains 
a value then it is added to the end of the location.
 
--
Zmitser Kozhukh___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users