Results 1 to 6 of 6

Thread: newbie question

  1. #1
    Join Date
    Apr 2003

    newbie question

    I have the following function and need help on using it.

    What I want to do:

    1: users enter values into textboxes
    2: values are converted (with function)
    3. Need to enter values into database.

    The function:

    //Get the easting, northing, id and UTM zone from the form
    x = document.pointType.easting.value;
    y = document.pointType.northing.value;
    id = document.pointType.Bed_ID.value;
    // Convert MCS to lat/lon
    var latLonPt = map.mcsToLonLat(x, y);
    window.location="add_GPS_Point.cfm?PT_LAT=" + latLonPt.getY() + "&PT_LON=" +
    latLonPt.getX() + "&UTM_EASTING=" + x + "&UTM_NORTHING=" + y + "&UTM_ZONE="
    + zone + "&ID=" + id;

    Can someone please help me ? What do I need to do - what should the rest of my code look like. I have set up a form, included the above function - but haven't had any success.
    I am new to javascript and have read several tutorial on functions - but an still at a lost with get the function to convert the input values.

    Thanks for your time,


  2. #2
    Join Date
    Feb 2003
    Derby, UK

    It looks like this function uses code from an object that is define elsewhere (the map object). Did you take this code from a website or a book or...? If so you need to either get the rest of the code or figure out what the

    map.mcsToLonLat(x, y);

    function does and replace it with one of your own.

    As regards the rest, it looks like it is expecting there to be a form with name 'pointType' containing three text fields called 'easting', 'northing' and 'Bed_ID' (I think there should be a fourth called zone as well judging by later code) that are used as the input to create the latitude and longitude.



  3. #3
    Join Date
    Apr 2003
    Dai - is this what you were looking for?

    function onDigitizedPoint(map, point)
    var xyPt = map.lonLatToMcs(point.getX(), point.getY());

    var resource = (parent.Eelgrasstop.document.Add.Feature_Type.value);
    switch (resource)
    case "Feature_Point":
    var loc = "Add_Point.cfm?LAT=" + point.getY() + "&LON=" + point.getX() + "&EAST=" + xyPt.getX() + "&NORTH=" + xyPt.getY() + "&RESOURCE=" + resource;
    win = window.open(loc,"AddPoint","status=no,resizable=yes,scrollbars=yes,width=750,height=280");
    alert("No available at this time.");

    How does this code work with the function?

    The code was give to me by somone working on a similar project. I am trying to figure how to do what I outlined in my first post by looking at her files - but am pretty confused as how they all work together - as this in my first time using javascript.

  4. #4
    Join Date
    Apr 2003
    Dai - or is this the code I need to accomplish my task?

    <object ID="map" WIDTH="101%" HEIGHT="100%"
    CODEBASE="http://www.shim.bc.ca/viewer/v6/mgaxctrl.cab#Version=6,0,2,2"> <param name="URL"
    <param name="Lat" value="">
    <param name="Lon" value="">
    <param name="MapScale" value="0">
    <param name="MapWidth" value="">
    <param name="Units" value="km">
    <param name="ToolBar" value="On">
    <param name="StatusBar" value="On">
    <param name="LayersViewWidth" value="200">
    <param name="ObjectLinkTarget" value="Eelgrassrpt">

    BORDER="0" WIDTH="101%" HEIGHT="100%" NAME="map" TYPE="application/x-mwf">

  5. #5
    Join Date
    Feb 2003
    Derby, UK
    The last one looks like the winner, though I could not tell you what it does, so it will probably be a bit hit and miss coding for it unless you can contact the provider of this object for documentation?

  6. #6
    Join Date
    Apr 2003

    getting there...

    Thanks for getting back to me Dai,

    I have made some progress - I can convert the input values using the function successfully now.

    Now I need to figure out how to pass the values that have been converted to a new page.

    I will put this question in a new post.

    I appreciate you taking the time to answer my posts.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles