[mapguide-dev] how to draw a polygon and save it?

Jason Birch Jason.Birch at nanaimo.ca
Mon May 29 15:33:40 EDT 2006


You will probably get better response on the "users" list.  The "dev"
list is for developers working directly on the MapGuide code.

As far as I've seen, there is no direct equivalent to the redlining
functions, especially in the area of per-feature styling.  It does look
like you could roll your own with a bit of work.

Have a look at the Digitize functions in the Map Frame section of the
Viewer API:

>From these, you would deal with the returned feature in JavaScript,
probably something that uses the Form frame's "Submit" method.  You may
need to somehow serialize the geographic object before sending it to the
form as a parameter.

In the form handler, you would need to create/reference a redlining
layer on the map.  The developer's guide provides information on working
with layers, and some code samples; the file layer_functions.php is

You will also need code that adds the redlining objects to data source
referenced by this layer.  You can add the features by either connecting
directly and using SQL, or through the FeatureService

As far as per-feature symbology goes, the only workaround I can see
would be to have a layer for each feature.  The general process would
look something like this:

- Create a new layer "group" for redlining
- Create the feature (have a look at MgInsertFeatures in the
FeatureService API) returning the ID of the created feature
- Create a layer that:
  - is not shown in the menu
  - has the redlining group as its parent
  - uses the desired symbology
  - references the specific feature ID of the newly-created object

Not sure how performant this would be though...


-----Original Message-----
From: Li Wang [mailto:*********@yahoo.com] 
Sent: Saturday, May 27, 2006 08:03
Subject: [mapguide-dev] how to draw a polygon and save it? 

Hi, I just move to Mapguide enterprise from MG6.5. I want to draw a few
lines and polygons and save them to a database. I do these easily in
MG6.5 by using redline functions. How can I do it in MGE? any help will
be appreciated.

Li Wang 

More information about the Mapguide-internals mailing list