We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Geocoding

Development and Programming

stinhambo's avatar
stinhambo
1,268 posts
17 years ago
stinhambo's avatar stinhambo

I would have thought the newer version of Thickbox might have done the trick as you can pass variables to it. I haven’t tried this yet though.

       
Ryan M.'s avatar
Ryan M.
1,511 posts
17 years ago
Ryan M.'s avatar Ryan M.

Yeah, me too! Except I just spent hours finding out it doesn’t, I don’t think. One thing I did find was that If I try to override the default output like so:

{prop_geolocation width="700" height="300"}

Nothing gets returned in the Thickbox, at least in FF. Removing parameters and using the defaults allowed it to work. So I set the default size to much larger than the Thickbox.

Crazy stuff. You wouldn’t believe how much googling I’ve done on this subject. Too much…it’s a freaking map!

       
stinhambo's avatar
stinhambo
1,268 posts
17 years ago
stinhambo's avatar stinhambo

I’m sure it’s something worth sharing though 😊

       
Ryan M.'s avatar
Ryan M.
1,511 posts
17 years ago
Ryan M.'s avatar Ryan M.

For the record, if you’re trying to get a google map to load in a Thickbox using Thickbox 3.1, you need to comment out two lines (first and last here):

// if($.browser.safari){//safari needs help because it will not fire iframe onload
     $("#TB_load").remove();
     $("#TB_window").css({display:"block"});
// }

Those are around line 229.

And now, because I feel so great about all the hours this took, I’ll share how I’m calling up the map. Obviously, I have Mark Huot’s Geo extension installed. I set the default width and height to 100% (instead of 300px) by changing these lines (around 557) in ext.geo.php:

$width = $this->fetch_param('width')!='' ? $this->fetch_param('width') : "100%";
$height = $this->fetch_param('height')!='' ? $this->fetch_param('height') : "100%";

I’ve also got jquery and thickbox all happening up in here. So….

1) User visits real estate page They say “Aw , cool, where is this swanky piece of real estate at? They see a link like this:

On the HTML page:

http://site.com/property/map/402/?KeepThis=true&TB_iframe=true&height=300&width=600

Under the hood (on the template):

{if prop_geolocation}
<a href="http://{path=property/map}{entry_id}/?KeepThis=true&TB_iframe=true&height=300&width=600class=thickbox">_Click to view Map »</a>
{/if}

So, we’ll be calling the map template and it will be looking at {segment_3} for the entry id.

2) Amazing map reveals itself Behold. (See attached pic of this actually working in FireFox/Mac. What does the map template look like, you say? Glad you asked, I feel like sharing.

Map Template A little bit edited for clarity, but all the good bits left in:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={charset}" />
<title>The Realty Company</title>

<style type="text/css">
html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    padding: 0;
    margin: 0;
    }

body {
    position: absolute;
    }

body * {
    margin: 0;
    padding: 0;
    }

#gmap {
    width: 100%;
    height: 100%; 
    padding: 0;
    overflow: hidden;
    }
#gmap > div { overflow: visible; }
</style>
</head>

<body>
<div id="gmap">
{exp:weblog:entries weblog="property" entry_id="{segment_3}"}
{prop_geolocation}
{/exp:weblog:entries}
</div>
</body>
</html>

That’s it. School’s out and I have 3288 characters remaining! May you have an easier time implementing than I did!

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Sorry to butt in on the end like this but just in case anyone hasn’t seen it before there is a script here that allows you to show co-ordinates in a Lightbox script. Maybe that could be made to work with your solutions too?

Best wishes,

Mark

       
textdriven's avatar
textdriven
107 posts
17 years ago
textdriven's avatar textdriven

Hi Mark,

this extension breaks the Edit Alert Extension. But Derek Jones has suggested how it can be fixed. http://ellislab.com/forums/viewthread/54925/P18/#351744

       
Adam George's avatar
Adam George
283 posts
17 years ago
Adam George's avatar Adam George

Invalid markup?

The validator seems to choke when I use this extension.

Error Line 259, Column 18: XML Parsing Error: StartTag: invalid element name . if(suggestedZoom < 12) {

My pages are utf-8 / XHTML 1.0 Strict.

The ‘offending’ bit of script that the extension spits out is:

if(suggestedZoom < 12) {
map.setCenter(new GLatLng(suggestedCenter.lat(), suggestedCenter.lng()), suggestedZoom);
}else{
map.setCenter(new GLatLng(-34.224009653753, 150.97137451172), 12);
}

Has anyone else had this problem? (with xhtml 1.0 strict)

       
stinhambo's avatar
stinhambo
1,268 posts
17 years ago
stinhambo's avatar stinhambo

So is there anything I’m missing here?

I have this code -

{exp:weblog:entries weblog="geomap" limit="1"}
    {location_geo_raw}
        {latitude}, {longitude}
    {/location_geo_raw} 
{/exp:weblog:entries}

Which outputs the co-ordinates correctly.

BUT if I use this code -

{exp:weblog:entries weblog="geomap" limit="1"}
    {location_geo width="400px" height="200px"} 
{/exp:weblog:entries}

I get nothing at all.

Do I need to add the Google API key at the top or anything else to my template to get this working?

       
Bruce2005's avatar
Bruce2005
536 posts
about 17 years ago
Bruce2005's avatar Bruce2005
Do I need to add the Google API key at the top or anything else to my template to get this working?

No, on mine if I view source the key is added automatically. Try without width/height and see if default works…

       
Paul Bell's avatar
Paul Bell
103 posts
16 years ago
Paul Bell's avatar Paul Bell

Great extension. Just wondered if there’s an easy way of using it on multiple sites using the Multiple Site Manager - works fine, apart from I need to supply a different API key for each site, since they’re on different domains? All works fine apart from I get the popup from Google telling me it’s the wrong API key, if I’m not on the original site.

       
Paul Bell's avatar
Paul Bell
103 posts
16 years ago
Paul Bell's avatar Paul Bell

OK, So I worked out that I can override the key with the key=”” parameter in the templates of one of the sites, so that shouldn’t be an issue. Only problem now is that I can’t see the maps in the control panel when I’m not editing the first site I set up. Any ideas?

EDIT: Just partly sorted this out - turns out that (on my site at least) if the field isn’t set to show by default, then the map editing widget comes up without any map tiles showing. Weird, but manageable.

Now I’m coming up against the problem that the maps don’t seem to show on the front end, even though they do on the backend. Not quite sure why, just not outputting any markup in these new templates.

       
Reese Spykerman's avatar
Reese Spykerman
41 posts
16 years ago
Reese Spykerman's avatar Reese Spykerman
I just ran into a little trouble: with GeoCoordinates installed the Edit Categories link in the Publish form disappears. Anyone else experience this? Or could it be a combination of other factors and/or installed extensions?

Thanks for this extension, Mark! I, too, am having the same issue that sneers reported. Edit categories now gone. Any suggestions on a code edit that can bring this back? Would love to be able to have both the map and edit categories working ok.

       
Punch Buggy Digital Agency's avatar
Punch Buggy Digital Agency
153 posts
16 years ago
Punch Buggy Digital Agency's avatar Punch Buggy Digital Agency

I don’t know if anyone has already done this but I needed {zoom} as a variable so I edited the code.

Heres the edit if anyone needs it.

Around line 522 - ext.geo.php

if(count($field_data) > 0)
{
    foreach($field_data as $point)
    {
        list($x, $y, $zoom) = preg_split("/\s*,\s*/", $point);
        if(!is_numeric($x) || !is_numeric($y) || !is_numeric($zoom)) continue;

        $tmp_str = $tags[2][$key];

        $tmp_str = str_replace(LD."longitude".RD, $x, $tmp_str);
        $tmp_str = str_replace(LD."latitude".RD, $y, $tmp_str);
        $tmp_str = str_replace(LD."zoom".RD, $zoom, $tmp_str);

        $looping_return.= $tmp_str;
    }
}

Best Regards

Emily

       
liquilife's avatar
liquilife
147 posts
16 years ago
liquilife's avatar liquilife

I know this thread is a bit dated, but this extension just made my night! Another hidden Gem for EE. I do have one question though. I am grabbing the latitude and longitude and sticking it in a javascript file to create a map with several pins. Not all of my entires will have geo-location. How can I run a conditional against this field to see if a geo entry has been entered? I’d like to filter out all entries with no geo-location information.

       
grantmx's avatar
grantmx
1,439 posts
16 years ago
grantmx's avatar grantmx

What happened when you tried to run it against the default EE conditionals?

{if geocode-whateva !=""} something.. {/if}
       
First 7 8 9 10 11 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.