[mapguide-users] digitizing features
Jackie Ng
jackie.ng at aecsystems.com.au
Tue Mar 6 09:55:45 EST 2007
Christoph,
If you look at the code from that site, the digitization -> new feature
process is done in server-side using the Resource Service and Feature
Service APIs. Most of the action in MapGuide occurs on the server-side.
All the javascript code does is start that server-side action. In the
example site. The javascript does a form submit to the server-side script.
The high-level overview (very brief, lots of blanks to fill) goes like this:
On the client-side (javascript):
- Call DigitizeXXX on the mapframe, passing a callback function.
- When the callback function is called, invoke the server-side script via
form submit, xmlhttprequest or other means, passing the attributes of the
digitized geometry.
On the server-side:
- Initialize and create your services.
- Create a new Feature Source or select a Feature Source where you want this
new feature to be inserted.
- Use an MgGeometryFactory to construct the appropriate geometry with the
given parameters from the client.
- Create an MgInsertFeatures passing the geometry and any extra properties.
Add it to the MgFeatureCommandCollection queue.
- Call MgFeatureService::UpdateFeatures passing the queued command
collection.
- Create a Layer from the Feature Source or pick an existing one already
created.
- Insert this new layer into your current map if it's not there already.
- Trigger a client-side refresh, by emitting javascript to cause a refresh
or some other means.
- The new feature should then be visible on the map.
With regards to where to call the DigitizeXXX method, you have to determine
two things:
- Where your calling page is (inside/outside the viewer frameset)
- Where the map frame is with respect to your calling page.
Then you can figure out how many frames to walk up/down the viewer frame
hierarchy to get to your map frame.
Also with Studio, it is a map/spatial data authoring tool, not a
web-development tool.
Hope that helps.
- Jackie
christoph g wrote:
>
> Hi Jackie,
>
> thank you for your explanation, but there are some questions left:
>
> - I visited the website
> http://data.mapguide.com/mapguide/devguide/index.php and I think my
> project should work similar to this. The digitized features should be
> transfered to esri shapefile, if not possible, to mysql database - I hope
> this is possible.
>
> - where (in whitch file or segment fo studio) do I call the DigitizeXXX
> javascript method?
>
> so long
>
> Christoph
>
>
>
> Jackie Ng wrote:
>>
>> Hi there,
>>
>> The mapguide viewer has built in functionality to perform digitizing.
>>
>> - You basically call the DigitizeXXX javascript method on the map frame
>> (where XXX is Line, Point, LineString, Polygon, Circle, Rectangle. When
>> you call that Digitize method, you need to pass a callback function that
>> Digitize will call when it is done. That method has one parameter, the
>> geometry object.
>>
>> eg.
>>
>> <script type="text/javascript">
>>
>> //start digitizing
>> function DigitizePoint() {
>> parent.parent.mapFrame.DigitizePoint(OnPointDigitized);
>> }
>>
>> //callback function
>> function OnPointDigitized(point) {
>> //do something with your digitized point.
>> }
>>
>> </script>
>>
>> - When the callback function is invoked, it's then up to you what you
>> want to do with that geometry object.
>>
>> Have you seen the examples on the sample site (the Digitizing and
>> Redlining sample) at http://data.mapguide.com/mapguide/devguide/index.php
>> ?
>>
>> - Jackie
>>
>>
>> christoph g wrote:
>>>
>>> Hello,
>>>
>>> I´m quite new to MapGuide OS. I hope somebody could help me and give me
>>> a step by step explanation.
>>> I made some maps in studio using my local data - quite nice and quite
>>> simple. But now I want to add a digitizing function for web users. A web
>>> user shoud be able to draw in the map. But this isn´t integrated in
>>> studio, so this is not simple. And I need a little support.
>>>
>>> Thanks
>>>
>>> Chris
>>>
>>>
>>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/digitizing-features-tf3350657s16610.html#a9333137
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list