[mapserver-users] copyright, logos, etc

Julien Cigar jcigar at ulb.ac.be
Wed Feb 11 05:56:57 PST 2015


On Wed, Feb 11, 2015 at 01:32:54PM +0000, Eichner, Andreas - SID wrote:
> > what I really need to do is to
> > make an SQL query (something like select name from map where id=%MYID%)
> > and use that attribute in the TEXT part of the FEATURE section (something
> > like FEATURE POINTS x y END TEXT "Species name: [name]" END)
> > 
> > Any idea is welcome on how to do that in the "Mapserver way" ..
> > 
> 
> I have not test it but I would suggest replacing the inlined feature with a OGR point layer connected to a MYSQL view or a OGR VRT datasource that associates every line with the position of the annotation.
> 
> 1) MYSQL view:
> CREATE OR REPLACE VIEW species_annotation AS SELECT id, GeomFromText('POINT(60 -10)') AS Shape, name FROM map;
> 
> LAYER
> ...
> 
> #  FEATURE
> #    POINTS
> #      60 -10    # the offset (from lower left) in pixels
> #    END # Points
> #    TEXT "© xyz company 2006"  # this is your displaying text
> #  END # Feature
>   CONNECTIONTYPE ogr
>   CONNECTION 'MYSQL: ...'
>   DATA 'species_annotation'
>   LABELITEM 'name'
>   FILTER ([id]=%MYID%)
> 
> ...
> END # Layer
> 
> 
> 2) OGR VRT datasource:
> In species_annotation.vrt:
> <OGRVRTDataSource>
>     <OGRVRTLayer name="species_annotation">
>         <SrcDataSource>MYSQL: ...</SrcDataSource>
>         <SrcSQL>SELECT id, 60 as x, -10 as y, name FROM map</SrcSQL>
>         <FID>id</FID>
>         <GeometryType>wkbPoint</GeometryType>
>         <LayerSRS>NULL</LayerSRS>
>         <GeometryField encoding="PointFromColumns" x="x" y="y" reportSrcColumn="false" />
>     </OGRVRTLayer>
> </OGRVRTDataSource>
> 
> Test with: ogrinfo -al species_annotation.vrt -fid <existing id>
> 
> 
> LAYER
> ...
>   CONNECTIONTYPE ogr
>   CONNECTION 'species_annotation.vrt'
>   DATA 'species_annotation'
>   LABELITEM 'name'
>   FILTER ([id] = %MYID%)
> ...
> END # Layer
> 
> 
> HTH

Thanks, I'll try it that way. Another idea I had was to create a POINT
layer with a FEATURE POINTS x y END END and use that layer in my SLD
stylesheet (which is generated dynamically) with a
<TextSymbolizer><Label>sometextblabla</Label> ... </TextSymbolizer> like
on https://gist.github.com/silenius/1f4a020f35a4113cdd4d but it seems
that it's unsupported by Mapserver (if I understand well
https://github.com/mapserver/mapserver/blob/master/mapogcsld.c#L2706 )

Would it be possible in the future to add support for a CDATA-like
section that goes directly within the FEATURE -> TEXT part of the layer?

Thanks!

Julien

-- 
Julien Cigar
Belgian Biodiversity Platform (http://www.biodiversity.be)
PGP fingerprint: EEF9 F697 4B68 D275 7B11  6A25 B2BB 3710 A204 23C0
No trees were killed in the creation of this message.
However, many electrons were terribly inconvenienced.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20150211/e06556ce/attachment.pgp>


More information about the mapserver-users mailing list