Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1050849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:49:59+00:00 2026-05-16T16:49:59+00:00

i have created the following function to show and address in JS: function showMapForm(idDiv,

  • 0

i have created the following function to show and address in JS:

function showMapForm(idDiv, divWidth, divHeight, idLat, idLng) {
    document.getElementById(idDiv).style.width = divWidth+'px';
    document.getElementById(idDiv).style.height = divHeight+'px';
    if (document.getElementById(idLat).value=='' && document.getElementById(idLng).value=='') {
        //Paris
        iniLat = 48.85455;
        iniLng = 2.358627;
    } else {
        iniLat = document.getElementById(idLat).value;
        iniLng = document.getElementById(idLng).value;
    }
    var latlng = new google.maps.LatLng(iniLat, iniLng);
    var myOptions = {
                    zoom: 15,
                    center: latlng,
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                    };
    map = new google.maps.Map(document.getElementById(idDiv), myOptions);

    marker = new google.maps.Marker({
                                        position: new google.maps.LatLng(iniLat, iniLng),
                                        map: map
                                        });

    google.maps.event.addListener(map, 'click', function(eve) {
        marker.setPosition(eve.latLng);
        document.getElementById(idLat).value = marker.getPosition().lat();
        document.getElementById(idLng).value = marker.getPosition().lng();
    });
}

as you can see it requires the id of a div, the width and height desired and the id of the hidden fields where I stock the latitude and longitude, if those values aren’t present it will use the latitude and longitude of Paris.
What i would like to do is to improve this function so it can accept a string value with an address like “Saint Joseph Street No. 45, Paris” and put a marker if it finds the address.

My question is: do you know if there’s a way to get a latitude and longitude from a search string using the google maps API? (the first occurrence will do it)

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T16:50:00+00:00Added an answer on May 16, 2026 at 4:50 pm

    Use the geocoder:

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following function: $(document).ready(function() { $('#p').click(function() { $('#s1').hide(); gameStart(); <-starts timer $('#s2').show();
Hi i have created the following ckeditor plugin to insert a youtube video: (function()
I have created the following function to check the first value of the check
I have created the following code to show and hide divs. This shows one
I have the following function: CREATE FUNCTION [dbo].[ListStockBySubCategory] ( @CategoryID varchar(10), @SubCategoryID varchar(10), @startRowIndex
I have the following function which creates a std::vector of iterators into another container:
I have the following function that takes a number like 5 and creates a
I have a strange one. Create a new form. Then add the following function
I have the following scalar function in MS SQL 2005: CREATE FUNCTION [dbo].[Distance] (
I have the following templated function... template< class T > T *create_object( lua_State *L

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.