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

New Fieldtype: MX Google Map (EE2)

Development and Programming

Max Lazar's avatar
Max Lazar
341 posts
about 16 years ago
Max Lazar's avatar Max Lazar

The MX Google Map fieldtype provides a field for include Google Maps into entries.

It’s a initial beta release. Please send me all issues and bugs. Feature requests welcome.

Working on… Code cleaning up Integration with MX Locator

Download / Documentation

Enjoy.

p.s. Thanks to EllisLab for great example in tutorials.

Update 04/28/2010 Today I had a free hour and make a litel bit progress in MX Google Map developing. What was done?

First of all I decide to give developers option to control the counts of request to DB - if you don’t planed to use multi geofields searching per one field group, you can choose mode without additional table. So during the adding new entrees and in the searching process the add-ons will make on 1-2 requests less. Actualy is tree modes for choosing – save data in separate table, in Channel data and Union (in last mode possible to choose the major geofield per weblog and do multi geofield searching or searching by major geofilds with less requests).

Storage locator (the same parameters as MX Locator has, but because MX Google map support multifield, two new tags – geofieled and geoloc for definition search terms):

{exp:mx_google_map:search  weblogs="article" reverse_geocoding= "true" adress="" log="" lat="" unit = "" 
    api_key="" radius = "500" prec="2" geofield="field_name1|field_name_2" geoloc="AND"}
        {title}  - {distance}
    {/exp:mx_locator:search}

you can output comple google map code by using this code

{exp:channel:entries channel="my_channel" limit="1"}
        {field_name maptype="HYBRID"  n_control_style= "SMALL" mt_control_style = "DROPDOWN_MENU" navigationControl = "false" scaleControl = "false" mapTypeControl= "false" scrollwheel = "false" icon="/beachflag.png" doubleclickzoomoff="true"}
    {/exp:channel:entries}

or just lat & long in case if you build map with you own rules

{exp:channel:entries channel="my_channel" limit="1"}
        {field_name}
        {latitude}: {longitude}
        {/field_name}
    {/exp:channel:entries}
  • multipoints mode
       
Derek Hogue's avatar
Derek Hogue
317 posts
about 16 years ago
Derek Hogue's avatar Derek Hogue

Max … maybe I’m being too sensitive here, but isn’t this just basically a clone of Stephen Lewis’ SL Google Map, ported to EE2 (which he will surely be doing himself in good time)?

       
ender's avatar
ender
1,644 posts
about 16 years ago
ender's avatar ender

I do a good bit of map work and have been considering writing my own field type for geocoding stuff… you may have saved me that effort but there’s one major thing I’d do differently than everyone else I’ve seen so far:

• save the latitude/longitude in a separate table related through the entry_id, then index the columns properly

This would be highly valuable to me because then you can access the latitude/longitude via SQL without having to unserialize in PHP. Plus with proper indexing you can then use distance formulas to find entries by proximity quickly in SQL. I also like to use Sphinx to run geographical queries (and searches in general), and you can’t feed it serialized data.

Would love to see a free map geocoding field type/extension that works this way. :D

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
about 16 years ago
Mark Bowen's avatar Mark Bowen
Max … maybe I’m being too sensitive here, but isn’t this just basically a clone of Stephen Lewis’ SL Google Map, ported to EE2 (which he will surely be doing himself in good time)?

I believe you can never have enough add-ons 😉 Max’s work is absolutely top-notch and I’m sure he will continue to support these for quite a while.

From myself, thanks for what looks like another excellent add-on Max.

Would love to see a free map geocoding field type/extension that works this way. :D

I’m sure that if Max wants to he will be able to do that 😉 The guy is as far as I’m concerned an add-on God.

Best wishes,

Mark

       
Max Lazar's avatar
Max Lazar
341 posts
about 16 years ago
Max Lazar's avatar Max Lazar

D-Rock First of all I have needs in this fieldtype for my current project where I used EE2. Is no any dates when SL Google map with EE2 support will release (even is not clear is it will free or commercial add-on). So for me it was better to write the new fieldtype. Here and now. And I glad to share it with community for free.

And what do you mean by “clone”? All js scripts was written from 0 (SL Google Map used API 2 - my scripts based on API 3, and I planed to release js part as my first jQuery google map plugin, out of EE). For php part, well I used EllisLab tutorial example of EE2 fieltype.

If you mean “clone by function” - SL Google map was not the first extension which gives possibility to integrate Google Map into EE (I really like CoolLocation before). I have a plane to make MX Google Map as package which will have all tools which needed to work with google map.

ender Yes, I have this functionality in MX Locator for SL Google Map and now I can add it as native support to my field with more better integration (MX Locator save it in the same table as entry in additional columns. Its give us some limits like not effective work with multi map fields in one entry, so at this moment I in the process of choosing – do I need the save data as MX Locator or to save data in separate table).

Mark Bowen Thanks! 😊

       
Derek Hogue's avatar
Derek Hogue
317 posts
about 16 years ago
Derek Hogue's avatar Derek Hogue

Max – I wasn’t implying that you re-used any of Stephen’s code, so please don’t take offense.

But lately, especially with the boon of interest around EE2, I’ve seen a lot of “me too” add-ons start to surface which offer little or no improvement over existing add-ons which are still maintained and supported. I guess it is an inevitable consequence of the growth of the community, but if you’ve ever perused the web for WordPress plug-ins, you might understand why such duplication of functionality can be frustrating for developers.

Like I said, maybe I’m being too sensitive here!

       
Max Lazar's avatar
Max Lazar
341 posts
about 16 years ago
Max Lazar's avatar Max Lazar

I know situation with WP plugins. And I can give my explanation of why the situation like this will unlikely in EE community but it is just not a place for discussion like this. (just one note – EE community pass the lesson that “EE monopoly add-ons” strategy have a weak points too.)

       
ender's avatar
ender
1,644 posts
about 16 years ago
ender's avatar ender
ender Yes, I have this functionality in MX Locator for SL Google Map and now I can add it as native support to my field with more better integration (MX Locator save it in the same table as entry in additional columns. Its give us some limits like not effective work with multi map fields in one entry, so at this moment I in the process of choosing – do I need the save data as MX Locator or to save data in separate table).

Yeah I downloaded MX Locator yesterday and poked around in the code for a bit to see how you’d stored the data. I’d love for it to be a separate table approach to remove the limits you mention. The biggest advantage of storing in a separate table would be the ability to geocode multiple locations for an entry… the front end map code and UI wouldn’t necessarily need to support that right away, but you’d have the ability to add that down the road without changing your data structure.

       
Luke Hardiman's avatar
Luke Hardiman
109 posts
about 16 years ago
Luke Hardiman's avatar Luke Hardiman
…Its give us some limits like not effective work with multi map fields in one entry…
I’d love for it to be a separate table approach to remove the limits you mention. The biggest advantage of storing in a separate table would be the ability to geocode multiple locations for an entry…

I agree, this would be a great feature. I’m currently using Mark Huot’s 2006 Geo extension to plot my tour route maps with multiple waypoints, but I don’t think he has released an update for around 4 years and it has a few usability issues.

       
Luca Chiesa's avatar
Luca Chiesa
3 posts
about 16 years ago
Luca Chiesa's avatar Luca Chiesa

Hi Max, I checked the downloaded package and it seems that language folder is empty. There is only an english” folder without files inside.

Obviously, when i try to open the pubblish page on EE2 I get:

An Error Was Encountered Unable to load the requested language file: language/english/lang.mx_google_map.php

😊

       
Max Lazar's avatar
Max Lazar
341 posts
about 16 years ago
Max Lazar's avatar Max Lazar

Thanks! Make repack in Friday and miss it. You can re-download the right package now.

       
Luca Chiesa's avatar
Luca Chiesa
3 posts
about 16 years ago
Luca Chiesa's avatar Luca Chiesa

Thank you Max 😊

I’m trying to setup a testing page for the plugin but all I get is a blank page. Probably i’m doing some mistakes.

Here’s the code i used in my template:

<html>
<head>
    <title>Googe Maps example</title>
</head>
<body>




{exp:channel:entries channel="studio" limit="1"}
{gmap maptype="HYBRID"  n_control_style= "SMALL" mt_control_style = "DROPDOWN_MENU" navigationControl = "false" scaleControl = "false" mapTypeControl= "false" scrollwheel = "false" icon="/beachflag.png" doubleclickzoomoff="true"}
{/exp:channel:entries}        

</body>
</html>

Where “studio” is my channel and “gmap” the field name i used.

Unfortunately, this code produces a blank page. Here’s the source of the page:



Any ideas? 😊

       
Max Lazar's avatar
Max Lazar
341 posts
about 16 years ago
Max Lazar's avatar Max Lazar

yep, the examples was corrupted. Couple lines was hide.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="/themes/mx_google_map/mxgooglemap.js"></script>

{exp:channel:entries channel="my_channel" limit="1"}
{field_name maptype="HYBRID"  n_control_style= "SMALL" mt_control_style = "DROPDOWN_MENU" navigationControl = "false" scaleControl = "false" mapTypeControl= "false" scrollwheel = "false" icon="/beachflag.png" doubleclickzoomoff="true"}
{/exp:channel:entries}
       
Luca Chiesa's avatar
Luca Chiesa
3 posts
about 16 years ago
Luca Chiesa's avatar Luca Chiesa

Ok Max, it works as expected now 😊

Thank you!

       
Max Lazar's avatar
Max Lazar
341 posts
about 16 years ago
Max Lazar's avatar Max Lazar

add update about progress in the topic start. And I still wait for your additional requests. I prefer to add all functionality now, than make changes after release. Please remember that is more than field - package has a plugin part so I can add not only operation with channel tag.

       
1 2

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.