[mapserver-dev] Using updateFromString on existing items

Lime, Steve D (MNIT) steve.lime at state.mn.us
Mon Oct 9 09:12:04 PDT 2017


I think we need to spend a little time looking at the code and the original RFC to properly document the “as is” behavior and then determine if any changes are necessary. Looking at the layer code I think my reference to “minor edits” is wrong. If you update a layer from a string in MapScript and that string contains classes then *new* classes are added to the layer object. If you want to update an existing class you’d have to update it directly from a string, not via the parent layer. Resetting the object would be a pretty drastic change. It may be that only projections need some sort of intervention to clear things out…

Steve

From: Tamas Szekeres [mailto:szekerest at gmail.com]
Sent: Monday, October 09, 2017 10:18 AM
To: Lime, Steve D (MNIT) <steve.lime at state.mn.us>
Cc: mapserver-dev at lists.osgeo.org
Subject: Re: [mapserver-dev] Using updateFromString on existing items

Hi Steve,

It is hard to interpret what are the allowed "minor edits" in such case. Neither the documentation or the corresponting rfc provides any guidance.
One can think a reasonable use case to completely deserialize the object state by using these methods.

Do we have a simple approach to reset the state of the object (as it was newly created) before calling the updateFromString method?

Thanks,

Tamas



2017-10-09 16:23 GMT+02:00 Lime, Steve D (MNIT) <steve.lime at state.mn.us<mailto:steve.lime at state.mn.us>>:

The original use case was to facilitate minor edits to existing object properties but not sub-objects. For example, you can't replace all the classes in a layer through a string update to the layer itself. We certainly could make all that work cleaner if there were demand.

At least you get a proper error message... ;-)



Steve

________________________________
From: mapserver-dev <mapserver-dev-bounces at lists.osgeo.org<mailto:mapserver-dev-bounces at lists.osgeo.org>> on behalf of Tamas Szekeres <szekerest at gmail.com<mailto:szekerest at gmail.com>>
Sent: Sunday, October 8, 2017 12:49:55 PM
To: mapserver-dev at lists.osgeo.org<mailto:mapserver-dev at lists.osgeo.org>
Subject: [mapserver-dev] Using updateFromString on existing items

Hi Devs,

Is that a supported use case to apply updateFromString on an existing item or it should only be used only on a newly created item?

For example when I use layerObj.updateFromString on an existing layer I get the following error

loadProjection(): General error message. Projection is already initialized. Multiple projection definitions are not allowed in this object. (line 10)

This is because we don't have a proper cleanup code on the existing layer before calling loadLayer on it. The same applies to the other object types.

Thanks,

Tamas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20171009/532f87c4/attachment-0001.html>


More information about the mapserver-dev mailing list