Drupal google maps tools vs gmap




















The actual map object seems to be in the map property of the object returned by the getMap function. Doing the above changed the zoom on the map on the page. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 11 years, 10 months ago. Active 11 years, 6 months ago.

Viewed 2k times. Improve this question. RedBlueThing Add a comment. Active Oldest Votes. This worked for me: Drupal. Improve this answer.

Benjamin Benjamin 21 2 2 bronze badges. Erik Ahlswede Erik Ahlswede 2, 2 2 gold badges 24 24 silver badges 36 36 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. It is worth mentioning that the architecture of the Geolocation module is open and well-refined, so you can easily add your functionality based on those listed above.

An alternative to the Geolocation Field module, being a somewhat competitive "ecosystem" of geographical modules. Geofield in its basic form is very simple and practical. In relation to the functionalities offered by Geolocation, Geofield also includes:. Regarding the integration of Geofield with Views — fields and filters based on the distance to a given point are available, but their configuration options do not include automatic detection of the user's location.

There are not many field display options in the basic Geofield version. It is not possible to display the position on a map. It would seem that the Geolocation module is a better choice, but the real strength of Geofield lies in the external add-on modules:. It is very easy to configure, it contains a form widget for selecting locations with address-based coordinate search , a formatter showing a given place on Google Maps, and a new view display mode that allows displaying results in the form of pins on a map.

Advanced users have a lot to choose from, starting with a map layer and ending with their own icons. This is important for websites with a high number of pageview hits. The creators of the module have implemented three mechanisms that allow for significant savings:. An alternative to Geofield Map, based on the open Leaflet. By default, it includes support for the free OpenStreetMap website.

The most important functionalities of the module are:. When describing the modules from the Geofield ecosystem, I have not yet mentioned the conversion of a postal address into coordinates. This is the domain of the perfectly designed Geocoder module. It expands widgets, formatters, and views with the possibility of geocoding based on several paid and free providers. The selection of a supplier is carried out separately for every element being configured, which allows for planning the possible costs very accurately.

There is a possibility that you do not need extensive geolocation options at all. The Simple Google Maps module is a significant simplification of what I have described so far.

It just provides a map formatter that can be set for any text field. When you enter an address in this field, the end-user will see a Google map generated based on their address. It is free and you do not have to obtain the API key. For obvious reasons, it does not offer the integration with Views or a widget to mark the position on a map in a form.

You have already learned about the basic modules for geolocation. Now it is time to use them on a specific example. We will create a places database where every entry will have a title, description, address, and coordinates.

We will display the list of places in the form of pins on a map. We often encounter this type of solution when creating corporate websites , for example when publishing information about events or facilities of a given company. We will need to install the following modules for the needs of our places database I recommend doing it using Composer because external libraries are required :.

Editing the places will definitely be the biggest challenge. We want the address to apply to any country. Every place must have coordinates, but they can be filled out based on the address. The address can also be filled out based on the coordinates.

Such an approach will greatly simplify the work of content creators. An additional assumption is using only free tools. Then we determine the relationship between these two fields. We want the address field to be filled out based on the map if the user has not entered the address.

And vice versa — for the place on the map to be filled out based on the address after pressing the button. In order to do this:. We choose free Nominatim on the list of suppliers. We also choose Nominatim on the list of suppliers.

When we try to create a new place, we will quickly conclude that using latitude and longitude is inconvenient. It is much easier to use the map for this purpose. A warning about the unconfigured Google API key will appear, but we can ignore it. This is because we will use the free Leaflet. The last step is to configure the aforementioned Nominatim website.

That is all! Now let us try to add a new place. After filling out the address fields, we click the Populate from the Address field button, and with any luck, we should get the location of the address on the map. If we will not add the address at all, just a place on the map — the address will be read based on coordinates. Now it is time to display the place. Now let us check out the page with a functional map created just now:. Displaying a list of places is just as easy.

We create a new view in which we show only the nodes with the Place content type. We set the Leaflet Map as the display format. Then, in the Leaflet Map format settings, we select Grouping field No. We get an interactive map with marked pins. We can quickly expand it with other functionalities, such as displaying only the places located 30 km from our location.

As you can see, the support for geolocation in Drupal requires a lot of knowledge, but it also allows you to create perfectly working solutions for your clients. The possibilities are almost limitless, while the time of implementation is relatively short. In our example, we have barely scratched the surface of the topic of maps and geocoding — it is actually much more extensive.

I encourage you to experiment on your own, also trying out the paid components from Google! Grzegorz Pietrzak. Additional capabilities include: A map widget working both with commercial suppliers Google Maps, Baidu, Yandex, Here and with the Open Leaflet library with OpenStreetMap map layers running by default.

There are many configuration options here, and no additional modules are required. Support for static Google maps in the form of a standard PNG file. Experimental support for geometric shapes on maps — both simple and complex ones.



0コメント

  • 1000 / 1000