Placing an infobox (overlay) manually near a pointer (overlay) on OpenStreetMaps












1















I am using some "advanced" pointers and infoboxes on my OpenStreetMap. Those markers and infoboxes is made as overlayes containing HTML. It is all working fine :-) But I am having a problem. I am always showing the infoboxes below the pointer (using lat and long for the pointer), but when a pointer i places near the top of the map, then I need to show the infoBox below the pointer. I have tried to solve that issue by multiplying the latitude with a number, but the number is depended on zoom level and latitude.



So my question is, is there a way to calculate a point, so it is always placed in the same visual distance from the pointer, on behalf of a given lat and long (the pointer)?










share|improve this question























  • I thing If ypu change the zoom level may solve your problem

    – LDS
    Nov 20 '18 at 10:15











  • Thanks for you reply. The problem appears when the user use the zoom function?

    – PNR
    Nov 20 '18 at 10:45











  • on the click event of the marker to display the infobox

    – LDS
    Nov 20 '18 at 10:47











  • I am really sorry, but I don't understand the solution you are suggesting.

    – PNR
    Nov 22 '18 at 7:41











  • I mean on the click event of the marker change the zoom level

    – LDS
    Nov 22 '18 at 8:12
















1















I am using some "advanced" pointers and infoboxes on my OpenStreetMap. Those markers and infoboxes is made as overlayes containing HTML. It is all working fine :-) But I am having a problem. I am always showing the infoboxes below the pointer (using lat and long for the pointer), but when a pointer i places near the top of the map, then I need to show the infoBox below the pointer. I have tried to solve that issue by multiplying the latitude with a number, but the number is depended on zoom level and latitude.



So my question is, is there a way to calculate a point, so it is always placed in the same visual distance from the pointer, on behalf of a given lat and long (the pointer)?










share|improve this question























  • I thing If ypu change the zoom level may solve your problem

    – LDS
    Nov 20 '18 at 10:15











  • Thanks for you reply. The problem appears when the user use the zoom function?

    – PNR
    Nov 20 '18 at 10:45











  • on the click event of the marker to display the infobox

    – LDS
    Nov 20 '18 at 10:47











  • I am really sorry, but I don't understand the solution you are suggesting.

    – PNR
    Nov 22 '18 at 7:41











  • I mean on the click event of the marker change the zoom level

    – LDS
    Nov 22 '18 at 8:12














1












1








1








I am using some "advanced" pointers and infoboxes on my OpenStreetMap. Those markers and infoboxes is made as overlayes containing HTML. It is all working fine :-) But I am having a problem. I am always showing the infoboxes below the pointer (using lat and long for the pointer), but when a pointer i places near the top of the map, then I need to show the infoBox below the pointer. I have tried to solve that issue by multiplying the latitude with a number, but the number is depended on zoom level and latitude.



So my question is, is there a way to calculate a point, so it is always placed in the same visual distance from the pointer, on behalf of a given lat and long (the pointer)?










share|improve this question














I am using some "advanced" pointers and infoboxes on my OpenStreetMap. Those markers and infoboxes is made as overlayes containing HTML. It is all working fine :-) But I am having a problem. I am always showing the infoboxes below the pointer (using lat and long for the pointer), but when a pointer i places near the top of the map, then I need to show the infoBox below the pointer. I have tried to solve that issue by multiplying the latitude with a number, but the number is depended on zoom level and latitude.



So my question is, is there a way to calculate a point, so it is always placed in the same visual distance from the pointer, on behalf of a given lat and long (the pointer)?







javascript typescript maps openlayers openstreetmap






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 '18 at 9:15









PNRPNR

1322416




1322416













  • I thing If ypu change the zoom level may solve your problem

    – LDS
    Nov 20 '18 at 10:15











  • Thanks for you reply. The problem appears when the user use the zoom function?

    – PNR
    Nov 20 '18 at 10:45











  • on the click event of the marker to display the infobox

    – LDS
    Nov 20 '18 at 10:47











  • I am really sorry, but I don't understand the solution you are suggesting.

    – PNR
    Nov 22 '18 at 7:41











  • I mean on the click event of the marker change the zoom level

    – LDS
    Nov 22 '18 at 8:12



















  • I thing If ypu change the zoom level may solve your problem

    – LDS
    Nov 20 '18 at 10:15











  • Thanks for you reply. The problem appears when the user use the zoom function?

    – PNR
    Nov 20 '18 at 10:45











  • on the click event of the marker to display the infobox

    – LDS
    Nov 20 '18 at 10:47











  • I am really sorry, but I don't understand the solution you are suggesting.

    – PNR
    Nov 22 '18 at 7:41











  • I mean on the click event of the marker change the zoom level

    – LDS
    Nov 22 '18 at 8:12

















I thing If ypu change the zoom level may solve your problem

– LDS
Nov 20 '18 at 10:15





I thing If ypu change the zoom level may solve your problem

– LDS
Nov 20 '18 at 10:15













Thanks for you reply. The problem appears when the user use the zoom function?

– PNR
Nov 20 '18 at 10:45





Thanks for you reply. The problem appears when the user use the zoom function?

– PNR
Nov 20 '18 at 10:45













on the click event of the marker to display the infobox

– LDS
Nov 20 '18 at 10:47





on the click event of the marker to display the infobox

– LDS
Nov 20 '18 at 10:47













I am really sorry, but I don't understand the solution you are suggesting.

– PNR
Nov 22 '18 at 7:41





I am really sorry, but I don't understand the solution you are suggesting.

– PNR
Nov 22 '18 at 7:41













I mean on the click event of the marker change the zoom level

– LDS
Nov 22 '18 at 8:12





I mean on the click event of the marker change the zoom level

– LDS
Nov 22 '18 at 8:12












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53389681%2fplacing-an-infobox-overlay-manually-near-a-pointer-overlay-on-openstreetmaps%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53389681%2fplacing-an-infobox-overlay-manually-near-a-pointer-overlay-on-openstreetmaps%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to pass form data using jquery Ajax to insert data in database?

National Museum of Racing and Hall of Fame

Guess what letter conforming each word