Coordinates

Discussion in 'HTML' started by Thibault, May 9, 2004.

  1. Thibault

    Thibault Guest

    Hello,

    I want to display an image in a specific place, using coordinates (i.e. x,
    y). How is this possible ? Is there anything else than javascript ?
    Thank you !

    Thibault
    --
    http://perso.wanadoo.fr/titan_keikomi/
     
    Thibault, May 9, 2004
    #1
    1. Advertising

  2. Thibault

    DU Guest

    Thibault wrote:
    > Hello,
    >
    > I want to display an image in a specific place, using coordinates (i.e. x,
    > y). How is this possible ? Is there anything else than javascript ?
    > Thank you !
    >
    > Thibault
    > --
    > http://perso.wanadoo.fr/titan_keikomi/
    >
    >


    x and y would be relative to which object? document? browser viewport?
    root element? DHTML layer? offsetParent node? immediate parent node?
    mouse position? user screen? user available (workarea) screen? This is
    important to know as there are many coordinates references to begin with.

    DU
     
    DU, May 9, 2004
    #2
    1. Advertising

  3. Thibault

    Thibault Guest

    "DU" a écrit dans le message news:
    > x and y would be relative to which object? document? browser viewport?
    > root element? DHTML layer? offsetParent node? immediate parent node?
    > mouse position? user screen? user available (workarea) screen? This is
    > important to know as there are many coordinates references to begin with.


    Relative to the browser window. My goal is to localize points on a map which
    is displayed in the background of the window.
     
    Thibault, May 9, 2004
    #3
  4. Thibault wrote:

    > Relative to the browser window. My goal is to localize points on a map
    > which is displayed in the background of the window.


    So that would be relative to the map, not the window.

    It also sounds like the map is content, rather then presentation, so it
    should be an <img> rather then a background.

    Then you can absolutely position the map and the "points" within a container
    that has position: relative;

    http://dorward.me.uk/www/css/#tutorials

    However, this is still depending on a presentation layer to mark up content.
    So perhaps you would be better off with a <map> instead.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
     
    David Dorward, May 9, 2004
    #4
  5. Thibault

    Thibault Guest

    "David Dorward" a écrit dans le message news:
    > So that would be relative to the map, not the window.


    Except that if I use the map as a background image, the window and the image
    have the same coordinates.


    > It also sounds like the map is content, rather then presentation, so it
    > should be an <img> rather then a background.


    Yes, but I can't put anything on an image, except areas, but they have no
    color so one can't see them. What I want to do is to display several points,
    using the same picture each time (a red, 4 by 4 px image), on the map. But I
    can't super-impose two images (I could if I used layers, but in that case it
    won't work with all browsers).


    > Then you can absolutely position the map and the "points" within a

    container
    > that has position: relative;
    >
    > http://dorward.me.uk/www/css/#tutorials


    The point is that my coordinates are in a MySql database and I use PHP to
    get them. So I can't use a CSS.


    > However, this is still depending on a presentation layer to mark up

    content.
    > So perhaps you would be better off with a <map> instead.


    What do you mean ? I have looked for a piece of information about the <map>
    tag in Google, but I found nothing. What is this map tag ?
     
    Thibault, May 9, 2004
    #5
  6. Thibault

    Whitecrest Guest

    In article <c7l8ja$fac$>,
    says...
    > Hello,
    > I want to display an image in a specific place, using coordinates (i.e. x,
    > y). How is this possible ? Is there anything else than javascript ?
    > Thank you !


    Depending on what you are talking about, you can use
    style="position:absolute;top:Y;left:x" or the class/id equivalent

    --
    Whitecrest Entertainment
    www.whitecrestent.com
     
    Whitecrest, May 9, 2004
    #6
  7. Thibault

    Whitecrest Guest

    In article <c7ldv5$bmh$1$>,
    says...
    > > Relative to the browser window. My goal is to localize points on a map
    > > which is displayed in the background of the window.

    > So that would be relative to the map, not the window.


    Well if the map is the background and it is at 0,0 then both are the
    same. (which is probably what he is talking about anyway)

    > However, this is still depending on a presentation layer to mark up content.
    > So perhaps you would be better off with a <map> instead.


    Probably so.

    --
    Whitecrest Entertainment
    www.whitecrestent.com
     
    Whitecrest, May 9, 2004
    #7
  8. Thibault wrote:

    >> It also sounds like the map is content, rather then presentation, so it
    >> should be an <img> rather then a background.

    >
    > Yes, but I can't put anything on an image, except areas, but they have no
    > color so one can't see them.


    So change the image so the target areas are visible.

    > But I can't super-impose two images (I could if I used layers, but in
    > that case it won't work with all browsers).


    "layers" ... http://dorward.me.uk/www/layers/

    > The point is that my coordinates are in a MySql database and I use PHP to
    > get them. So I can't use a CSS.


    Why not?

    >> However, this is still depending on a presentation layer to mark up

    > content.
    >> So perhaps you would be better off with a <map> instead.

    >
    > What do you mean ? I have looked for a piece of information about the
    > <map> tag in Google, but I found nothing. What is this map tag ?


    It is the element that contains <area> elements.

    http://www.w3.org/TR/html4/index/elements.html

    It sounds like the best bet would be to use PHP To dynamically generate your
    image and then use an image map on top of it. Another option might be to
    use a form and have the image be an image input, which would allow you to
    read coordinates from it on the server (but break entirely for users
    without pointing devices).

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
     
    David Dorward, May 9, 2004
    #8
  9. Thibault

    Dave Patton Guest

    "Thibault" <> wrote in
    news:c7lf7u$96g$:

    >> It also sounds like the map is content, rather then presentation, so
    >> it should be an <img> rather then a background.

    >
    > Yes, but I can't put anything on an image, except areas, but they have
    > no color so one can't see them. What I want to do is to display
    > several points, using the same picture each time (a red, 4 by 4 px
    > image), on the map. But I can't super-impose two images (I could if I
    > used layers, but in that case it won't work with all browsers).


    > The point is that my coordinates are in a MySql database and I use PHP
    > to get them. So I can't use a CSS.


    Sounds just like the maps we have at confluence.org:
    http://www.confluence.org/country.php?id=5
    With the coordinates(in whatever system you want to use)
    of both the map and the points stored in MySQL, you
    use PHP and GD to take "the map image", build a new
    map image with the points, and send that image to the browser.

    --
    Dave Patton
    Canadian Coordinator, Degree Confluence Project
    http://www.confluence.org/
    My website: http://members.shaw.ca/davepatton/
     
    Dave Patton, May 9, 2004
    #9
  10. Thibault

    Thibault Guest

    "David Dorward" a écrit dans le message news:
    > > The point is that my coordinates are in a MySql database and I use PHP

    to
    > > get them. So I can't use a CSS.

    >
    > Why not?


    Yes, you're right, I'm trying this right now and it seems to work ! Thank
    you.
     
    Thibault, May 10, 2004
    #10
  11. Thibault

    Thibault Guest

    "Dave Patton" a écrit dans le message news:
    > Sounds just like the maps we have at confluence.org:
    > http://www.confluence.org/country.php?id=5


    I really like this project ! It seems really bizarre, but how fun !
    Unfortunately, there is no confluence left in my area (centre of France) ...


    > With the coordinates(in whatever system you want to use)
    > of both the map and the points stored in MySQL, you
    > use PHP and GD to take "the map image", build a new
    > map image with the points, and send that image to the browser.


    Yes, but I don't want to use GD. But I have succeed in doing my map with
    points and background image and all. Neverthemore, I still have a problem,
    and it seems that you could help me when I see what you did on confluence
    website. Here it is : I can't find a formula to change longitude and
    latitude in pixels number, according to the size of my map. Some points are
    in the correct place, but most are not. Do you have a solution for this
    problem ?

    Thank you !
     
    Thibault, May 10, 2004
    #11
  12. Thibault

    Jeff Thies Guest

    OT for html

    "Thibault" <> wrote in message
    news:c7nark$qb1$...
    >
    > "Dave Patton" a écrit dans le message news:
    > > Sounds just like the maps we have at confluence.org:
    > > http://www.confluence.org/country.php?id=5

    >
    > I really like this project ! It seems really bizarre, but how fun !
    > Unfortunately, there is no confluence left in my area (centre of France)

    ....
    >
    >
    > > With the coordinates(in whatever system you want to use)
    > > of both the map and the points stored in MySQL, you
    > > use PHP and GD to take "the map image", build a new
    > > map image with the points, and send that image to the browser.


    That's a nice idea. CSSP works in browsers dating back to NS4 and IE3
    though.

    >
    > Yes, but I don't want to use GD. But I have succeed in doing my map with
    > points and background image and all. Neverthemore, I still have a problem,
    > and it seems that you could help me when I see what you did on confluence
    > website. Here it is : I can't find a formula to change longitude and
    > latitude in pixels number, according to the size of my map. Some points

    are
    > in the correct place, but most are not.


    Let's just toss aside different mapping systems for the time being. Miles
    between differing longitudes are greater at the equator than at the poles. O
    miles at poles, 69 miles/degree at equator.

    This is perl, php will be similar

    sub convertToMiles{
    ($lat1, $lon1, $lat2, $lon2)=@_;
    $dist = acos(sin(deg2rad($lat1)) * sin(deg2rad($lat2)) +
    cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($lon1 - $lon2)));

    $dist = rad2deg($dist);
    return my $miles = $dist * 69;
    }

    sub deg2rad{
    my $deg=shift;
    return (2 * $pi *$deg/360);
    }

    sub rad2deg{
    my $rad=shift;
    return ($rad * 360/( 2 * $pi));
    }


    Perhaps you've forgotten to account for that?

    Plug in a 1 degree change to find the miles per degree longitude at your
    latitude. Then use the map scale factor.

    Jeff



    > Do you have a solution for this
    > problem ?
    >
    > Thank you !
    >
    >
     
    Jeff Thies, May 10, 2004
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    21,526
    Jim Gibson
    Nov 4, 2003
  2. Berk Birand

    Read coordinates

    Berk Birand, Mar 6, 2004, in forum: Perl
    Replies:
    2
    Views:
    585
    Berk Birand
    Mar 7, 2004
  3. Stimp

    coordinates of a DIV

    Stimp, Sep 22, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    28,497
    David Jessee
    Sep 22, 2004
  4. Suresh  Kumar
    Replies:
    0
    Views:
    612
    Suresh Kumar
    Jul 3, 2003
  5. Suresh  Kumar
    Replies:
    0
    Views:
    528
    Suresh Kumar
    Jul 4, 2003
Loading...

Share This Page