[postgis-users] AsSvg

Rick graham.rick at gmail.com
Mon Sep 13 10:08:31 PDT 2010


On Mon, Sep 13, 2010 at 12:46 PM, Bob Pawley <rjpawley at shaw.ca> wrote:

>  Rick - thanks for answering.
>
> I am in the process of learning a little XML.
>
> I understood that a query such as 'Select AsSvg(the_geom) from p_id.image'
> went to Postgis and the return (the geometry) comes back.
>
> I think you are saying that this is also in the xml path and xml interprets
> this expression differently than 'Select the_geom from p_id.image'
>

Not exactly.  You will need to understand the basics of an XML document, and
a little SVG before you can use this.

Here is a link to the SVG spec regarding paths, it will enlighten you on
what you need to sort out.

http://www.w3.org/TR/SVG/paths.html#PathElement

See the example in red fine type.  That is a valid SVG document with the
path element:

*<path d="M 100 100 L 300 100 L 200 300 z" fill="red" stroke="blue"
stroke-width="3" />*

'd' is the attribute in the path that tells it how to draw, the value of the
d attribute is "M 100 100 L 300 100 L 200 300 " and this is what PostGIS
returns from the AsSvg() call.

That element draws a polyline from (M 100,100) to (300,100) to (200,300) and
closes it (z) fills it with red, strokes it in blue with a stroke width of 3
pixels. (px is the default)

You can use the fragment in the example to form your own documents and style
them.

Be aware that you can also use CSS to style SVG, should you happen to be
familiar with it.

Have fun.


> Bob
>
>
>  *From:* Rick <graham.rick at gmail.com>
> *Sent:* Monday, September 13, 2010 9:08 AM
> *To:* PostGIS Users Discussion <postgis-users at postgis.refractions.net>
> *Subject:* Re: [postgis-users] AsSvg
>
>
> Not sure what you are asking, but I'll take a stab in the dark.
>
> When you retrieve geometry as SVG what you get back is the contents of a
> path attribute node.
>
> So if an SVG path element is written <path d="X"/> the result of the query
> is "X", or the value of the 'd' (data) attribute, not an XML element, and
> certainly not a valid SVG document.  You have to construct these yourself.
>
> On Mon, Sep 13, 2010 at 12:00 PM, Bob Pawley <rjpawley at shaw.ca> wrote:
>
>>  Hi
>>
>> I may be on the wrong list but xml and Delphi guys that know Postgis seem
>> to be few and far between.
>>
>> I`m using the following to display the binary data on a memo component as
>> text.
>>
>>  PSQLQUery1.SQL.Add('Select the_geom from p_id.image');
>>     PSQLQUery1.SQL.Add ('where p_id.image.p_id_id = ''1534''');
>>     PSQLQUery1.Open;
>>
>> This works fine.
>>
>> When I change it to select AsSvg the xml consider assvg as another node
>> and the geometry data does not appear.
>>
>>  PSQLQUery1.SQL.Add('Select AsSvg(the_geom) from p_id.image');
>>     PSQLQUery1.SQL.Add ('where p_id.image.p_id_id = ''1534''');
>>     PSQLQUery1.Open;
>>
>> If any one can suggest a possible reason for this behavior It would be
>> appreciated.
>>
>> Bob
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>
>
> --
> Cheers!
> Rick
> Eeny, Meeny, Jelly Beanie, the spirits are about to speak!
>         -- Bullwinkle Moose
>
>  ------------------------------
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>


-- 
Cheers!
Rick
Eeny, Meeny, Jelly Beanie, the spirits are about to speak!
        -- Bullwinkle Moose
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100913/9879fcdd/attachment.html>


More information about the postgis-users mailing list