Studio: reset to defaults?

Andy Morsell amorsell at
Tue Apr 4 20:38:08 EDT 2006

Thanks Tom.  I will give that a try in a couple of days.  I had the first two
parts figured out, but you helped close the circle pointing out that I could
load the modified XML directly via the mapagent.

I do appreciate that you are considering this for future releases of Studio. 
I am setting this up for a client who will be adding more and more data to
their maps over time and these templates will be important.  They will not
easily be able to use the "work-around" method.  

Also, I wanted to point out that I am seeing this when only one field
definition is different.  In the "template" layer, there is a CITY field,
but the feature source I'm trying to apply to the template does not have
that field, but every other field is the same.  CITY is not used in any of
the layer expressions, including property, name, labels, themes, etc.  Just
the fact that it does not exist is enough to cause this problem.

Tom Fukushima wrote:
> Hi Andy,
> During development we had thought about the following: When changing the
> feature class for the layer, first scan the LayerDefinition and find all
> properties used in expressions. Then check that these properties match
> properties in the new feature class.  If they do match, then we consider
> them to be compatible and then allow the layer author to continue.  Then
> to go a bit further, when changing feature sources, we would try to find
> a compatible feature class in that new feature source to use.  Doing
> this, was just a matter of time really.
> And of course, there is also the approach of having a "I know what I'm
> doing, leave things as is" button on the "Incompatible data sources"
> dialog.  However, this requires thorough testing to make sure that
> anything that gets through does not cause subsequent failures in Studio.
> Again, just a matter of time.
> Editing the layer definition externally from Studio is possible and here
> is one recipe for it.
> In Studio
> 1) Make a copy of the layer definition
> 2) Open the layer definition and do a File > Save As XML...
> 3) Close the layer definition editor.
> In your favorite XML editor
> 4) Open the saved file
> 5) In the XML, find the FeatureSource used by the layer. It will be
> enclosed in ResourceId tags.  Change the resource to point to the
> correct feature source.
> 6) Save the file.
> Using Internet Explorer
> 7) Open the server web pages:
> http://servername/mapguide/mapagent/index.html
> 8) Click on the SetResource link in the bottom left pane.
> 9) In the Resource ID field, type the name of the layer definition.
> This will have the form Library://path/layer.LayerDefinition.
> 10) In the Content field, click the Browse button and find the XML file
> that you edited in step 5.
> 11) Leave the Header blank. 
> 12) Press Submit.
> You should now be able to open and edit the changed layer definition in
> Studio.
> Cheers
> Tom
>   _____  
> From: Andy Morsell [mailto:amorsell at] 
> Sent: Friday, March 31, 2006 5:41 PM
> To: users at
> Subject: [mapguide-users] Studio: reset to defaults?
> This is a Studio issue, not a MGOS issue.  I am authoring several
> different road layers from Shape files (converted to SDF during load).
> These are all standardized in terms of the defined feature types (major,
> minor, local roads, etc).  I have defined a layer based on one that has
> multiple scale ranges, each with the thematic definition.  I then copy
> this layer definition to another location to use as a template for a
> different data source.  This seems to work OK (despite several .NET and
> JIT warnings) for the most part.  
> However, it appears that if the feature source being chosen has any
> difference in field definitions from the feature source that the layer
> was originally created from, then Studio pops up a dialog that says:
> "Reset to defaults? - You're about to change to an incompatible data
> resource.  Proceed and reset the layer to defaults?".  If I say OK, all
> of the styles already in place are reset to scratch.  I don't understand
> why it would do this since the field that is being themed is the same
> name and type in both feature sources.
> I don't see any way around this.  I don't believe the layer definition
> can be edited externally from Studio, or can it?  Can this behavior be
> changed in a future release of Studio so that we can have more control
> over style "templates"?
> Thanks. 
> Andy Morsell, P.E. 
> Spatial Integrators, Inc. 
> <>  

View this message in context:
Sent from the OSGeo MapGuide forum at

More information about the Mapguide-users mailing list