• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Autodesk MapGuide Developer

    Reply
    Distinguished Contributor kb
    Distinguished Contributor
    Posts: 201
    Registered: ‎11-25-2003

    Populating a Database

    22 Views, 6 Replies
    03-10-2003 07:15 AM
    Hi,

    Currenlty I have a drawing utility that allows users to add lines, polygons or points (symbols) to their local map in the MG viewer. I have managed to (as a test) extract the symbol attributes, and lat/long of the point added with an alert box in the map. I would like to know how this data can be populated within a database. So when a user adds a hydrant symbol for instance, it will be added on a hydrant layer, (instead of the redline layer) and have the data populate in the database. The rest of the users would then be able to see the symbol within their map, as the database would be dynamic. I'm pretty sure this can be done.

    I hope this makes sense. I do not have the DAT extension, and am using MG6. Any hellp would be greatly appreciated.

    Thanks,
    kb
    Please use plain text.
    *Sandoval, Cesar

    Re: Populating a Database

    03-11-2003 08:38 PM in reply to: kb
    how i saw you need update your database when the user make add point for
    example (hydrant) in his map ,well you need put maybe before or runtime of
    layer with this dtabase and when the ondigitisepoint event fire you connect
    to database make a insert statement with data of point digitized and any
    else data you need input and close connection .all maps with dynamic
    propertie anywhere will update and saw the points added.
    i hope can help you
    best regards

    --

    --
    Cesar A. Sandoval M.
    Developer Specialist in GIS/CAD/WEB
    PROFILE CONSULTING GROUP S.A.
    www.profileconsulting.net
    Please use plain text.
    Distinguished Contributor kb
    Distinguished Contributor
    Posts: 201
    Registered: ‎11-25-2003

    Re:

    03-13-2003 07:27 AM in reply to: kb
    I've tried using a CFinsert to populate the data that is retrieved but that is not working either. I'm get errors that either say columns don't exist in the table, or the option is not implemented. I have full control of the database and the network it resides on.

    Does anyone else have any suggestions? Sample code would be a huge plus.
    Please use plain text.
    *Wynter, August de

    Re:

    03-17-2003 05:40 PM in reply to: kb
    A Walk Down Memory Lane, back in the days of MG3 this functionality was
    known as
    "put yourself on the map" and was featured on mapguide.com.

    I haven't used Cold Fusion in a while, but I used to skip CFINSERT and
    generally used CFQUERY (mind the single quotes for text inserts)


    INSERT INTO website
    (lon, lat, sitename)
    VALUES(#lon#, #lat#, '#sitename#')


    Hope this helps
    Please use plain text.
    Distinguished Contributor kb
    Distinguished Contributor
    Posts: 201
    Registered: ‎11-25-2003

    Re:

    03-18-2003 11:56 PM in reply to: kb
    Hi,

    When using the Insert with the CFquery, did you create an "Action" page to insert the data in first, before you brought it into the database?

    I guess I'm refering to the website parameter you added in your code example. I would like to populate the database directly from what the user adds in the viewer, without first populating an action page (form).

    Thanks for the reply, you've giving me some direction I deperately need.
    Please use plain text.
    *Wynter, August de

    Re:

    03-19-2003 05:38 PM in reply to: kb
    Indeed, I used an "Action" page to get some additional information from the
    user. But if you don't need any user info, you can also call the insert
    page directly from the onDigitizedPoint function. The insert page can be
    anything from a "Thank you for Clicking" page to a GUI less page which will
    run in a hidden frame.

    onDigitizedPoint will provide you with a point from which you can get the X
    and Y values. These values can be used to open the insert page in your
    application which will populate the databasetable and refreshes the map.

    function onDigitizedPoint(map, point)
    {
    var Y = point.getY();
    var X = point.getX();
    var insertPage = 'insert.cfm?x='+X+'&y='+Y;
    parent.insertFrame.location.replace(insertPage);
    }

    insert.cfm would look something like this:


    INSERT INTO myDatabaseTable
    (x, y)
    VALUES(#x#, #y#)







    Many Thanks for adding a new point to the layer

    Please use plain text.
    Distinguished Contributor kb
    Distinguished Contributor
    Posts: 201
    Registered: ‎11-25-2003

    Re:

    03-21-2003 01:39 AM in reply to: kb
    Thanks for the help. I have the database info getting populated. Although when I refresh the screen the point is added to the database again, and again, it seems to be storing the value in the insert.cfm. But I should be able to set a zero value to the query in order to stop it populating.

    Thanks again, this is a very good start to populating the rest of the data I need.
    Please use plain text.