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

  • Home
  • SEARCH
  • 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 3595934
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:55:04+00:00 2026-05-18T19:55:04+00:00

I’m doing an application in Django that has a small map in the user

  • 0

I’m doing an application in Django that has a small map in the user profile (provided by django-profile, but modified to use GMaps v3)

The thing is that any coordinate I put in the constructor it’s represented wrong in the map. Currently I’m putting the coordinates of Santiago de Compostela (spain) at Lat. 42.88 and Long. -8.55 but Google maps keeps telling me that I’m in Bayingolin (China).

Bythe way, the same happens with Google Maps v2, it locates the coordinates wrong.

Here’s the code:

{% block content %}
    {% if GOOGLE_MAPS_API_KEY and user.get_profile.location %}
        <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
        <meta name="viewport" content="initial-scale=1.0, user-scalable=yes">
        <script type="text/javascript">
        function initialize() {
            var latlng = new google.maps.LatLng( {{ user.get_profile.latitude }}, {{ user.get_profile.longitude }} );
            var opts = {
                zoom: 10,
                center: latlng,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var map = new google.maps.Map(document.getElementById("location"), opts);
            var marker = new google.maps.Marker({
                position: latlng,
                map: map,
                title: "Test"
            });
        }
    </script>
    {% endif %}
<div id="profile">
<div id="profile_right">
    <div id="avatar" class="span-3 center">
        <a href="{% url profile_edit_avatar %}">
            <img class="border" src="/static/generic.96.jpg" />
        </a>
        <p><a href="{{ request.path_info }}edit/avatar/">{% if user.get_profile.has_avatar %}{% trans "Change avatar" %}{% else %}{% trans "Add avatar" %}{% endif %}</a></p>
    </div>

    <div>
        <p>{% trans "Username: " %} {{ user }}</p>
        <p>{% trans "Real name: " %} {{ user.first_name }} {{ user.last_name }}</p>
        <p>{% trans "Age: " %} {{ user. }}
        <p>{% trans "Member for: " %} {{ user.date_joined }}</p>
        <p>{% trans "E-mail:" %}
            <span class="{% if not email or not validated %}quiet red{% endif %}">
            {%if not email %}
                {% trans "Not set yet" %}
            {% else %}
                {{ email }}
                {% if not validated %}
                    {% trans " (Not validated)" %}
                {% endif %}
            {% endif %}
            </span>
        </p>
        <p>
        <label for="location">{% trans "Country" %}:</label>
        {% if user.get_profile.country %}
            {{ user.get_profile.get_country_display }}
        {% else %}
            <span class="quiet red">{% trans "Not set" %}</span>
        {% endif %}
        </p>

        <p>
            {% trans "Ciudad: " %} {{ user.get_profile.province }}
        </p>

    </div>
</div>

<div id="profile_left">
    {% if GOOGLE_MAPS_API_KEY %}
        <p>{% trans "Location" %}:
            {% if user.get_profile.location %}
                {{ user.get_profile.location }}
            {% else %}
                {% trans "Not set" %}
            {% endif %}
        </p>
    {% endif %}
    {% if user.get_profile.location %}
        <div class="span-12 last">
            <div id="location" style="width: 480px; height: 240px;"></div>
        </div>
    {% endif %}
</div>
</div>

Here is a screenshot with the result:
alt text

  • 1 1 Answer
  • 0 Views
  • 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-18T19:55:05+00:00Added an answer on May 18, 2026 at 7:55 pm

    Actually, I had the same problem that the I10N engine reformatted my decimal output. A workaround for me was to use the stringformat:"s" filter for outputting decimal numbers in the Javascript part of the templates.

    In your case that would be:

    var latlng = new google.maps.LatLng( {{ user.get_profile.latitude|stringformat:"s" }}, {{ user.get_profile.longitude|stringformat:"s" }} );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am trying to loop through a bunch of documents I have to put
I have a bunch of posts stored in text files formatted in yaml/textile (from
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm making a simple page using Google Maps API 3. My first. One marker
I have some data like this: 1 2 3 4 5 9 2 6

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.