Coordinates

T

Thibault

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
 
D

DU

Thibault said:
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

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
 
T

Thibault

"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.
 
D

David Dorward

Thibault said:
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.
 
T

Thibault

"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 ?
 
W

Whitecrest

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
 
W

Whitecrest

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.
 
D

David Dorward

Thibault said:
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?
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).
 
D

Dave Patton

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.
 
T

Thibault

"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 !
 
J

Jeff Thies

OT for html

Thibault said:
"Dave Patton" a écrit dans le message news:

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

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top