0

i have to variables xx = 38.929787 yy = 22.675781

how can i pass them from python to GLatLng(lat,long) inside the javascript an have lat = xx and long =yy

def pymapjs(self):
 """ Returns complete javacript for rendering map """
self.js = """\n<script src=\"http://maps.google.com/maps?file=api&amp;v=2&amp;key=%s\" type="text/javascript"></script>
 <script type="text/javascript">
 //<![CDATA[
 function load() {
 if (GBrowserIsCompatible()) {
 function Point(lat,long,html,icon) {
 this.gpoint = new GMarker(new GLatLng(lat,long),icon);
 this.html = html;
 } 
asked May 12, 2014 at 12:50

1 Answer 1

1

Do this:

self.js = """\n<script src=\"http://maps.google.com/maps?file=api&amp;v=2&amp;key=%s\" type="text/javascript"></script>
 <script type="text/javascript">
 //<![CDATA[
 function load() {
 if (GBrowserIsCompatible()) {
 function Point(lat,long,html,icon) {
 this.gpoint = new GMarker(new GLatLng(%f,%f),icon);
 this.html = html;
 }""" % (xx, yy)
answered May 12, 2014 at 12:59
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.