[OpenLayers-Users] Properties of Vector Features to be printed Using MapFish Print
Jerome A. Wendell
jawendell at suddenlink.net
Sat Feb 15 12:37:15 PST 2014
Mark,
Thanks again for your reply.
I tried your suggestion using:
feature.data._gx_style = 1;
It did add the _gx_style = 1 to the feature as data. When I serialized it to json, the added property did not show up. So I tried the following:
feature.attributes._gx_style = 1;
This added the _gx_style = 1 to the feature as an attribute. When I serialized it to json, the _gx_style property was right where I needed it to be. So, you basically got me on the right track, and now my print job completes successfully.
I really appreciate your input.
Jerome Wendell
From: openlayers-users-bounces at lists.osgeo.org [mailto:openlayers-users-bounces at lists.osgeo.org] On Behalf Of Jerome A. Wendell
Sent: Saturday, February 15, 2014 10:41 AM
To: Mark Prins; OpenLayers User List
Subject: Re: [OpenLayers-Users] Properties of Vector Features to be printed Using MapFish Print
Mark,
Thanks for your reply and suggestion. I will give that a try.
Jerome Wendell
Sent from Samsung Mobile
-------- Original message --------
From: Mark Prins <mc.prins at gmail.com>
Date: 02/15/2014 5:16 AM (GMT-05:00)
To: OpenLayers User List <openlayers-users at lists.osgeo.org>
Subject: Re: [OpenLayers-Users] Properties of Vector Features to be printed Using MapFish Print
2014-02-14 23:07 GMT+01:00 Jerome A. Wendell <jawendell at suddenlink.net>:
> I basically have the spec to print my map with the desired layers, except
> for one property that I have not been able to include in the geojson string
> for the features. I am using OpenLayers Version 2.12. The spec is as
>
> I have highlighted the property that I need to include in the spec. I have
> tried to add it to the geoJson representing the feature by using the
> following code:
>
>
>
> var featureFormat = new OpenLayers.Format.GeoJSON();
>
> var featureGeoJson = featureFormat.write.call(
>
> featureFormat, feature);
>
> featureGeoJson.properties = OpenLayers.Util.extend({
>
> _gx_style: 1
>
> },featureGeoJson.properties);
>
I'd try extending/modifying the feature before serializing to json,
something like:
```
feature.data._gx_style = 1;
var featureGeoJson = featureFormat.write.call(featureFormat, feature);
```
--
Disclaimer;
This message is just a reflection of what I thought at the time of
sending. The message may contain information that is not intended for
you or that you don't understand.
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20140215/46e90b9b/attachment.html>
More information about the Users
mailing list