Drupal 7 GMAP module - drupal-7

I am using the gmap module for Drupal 7 along with location and node location module enabled.
I have added a simple location field in my article content type. I have enabled the location block to be shown in main content type.
Now during creation of an article when I enter location values as text fields(like countries,cities etc.) without any latitude and longitudes then the map is not displayed on the article node page.
However if i do enter some latitude longitude values(either manually) or using google map's then in the article node page the map is shown.
So anybody has any ideas about this?It should work like even if i enter a country name and state it should show me the map with the marker

Hope its not too late for the answer, probably this will be helpful to someone googling for the issue..
I faced similar problems and in the end it turned out that GeoCoding was not enabled in Location module settings for the country which I was adding entries for.
You can enable GeoCoding from Location module settings (admin/config/content/location) 'GeoCoding Options' tab.

Related

Capture and Store Address with React in MongoDB

Trying to understand how to capture and store address in React.
I would like to achieve autocomplete functionality, so that user wouldn't be able to enter some scribbled address, instead user would start typing and then choose an address.
Ideally this address Component would return coordinates to save in MongoDB.
At the moment I am trying to figure out if Google is the right way to go, as there has been major pricing changes and I've heard that it's crazy expensive.
Conversely with the Mapbox I'm struggling big-time finding a working solution for this.
The needs are quite simple and as follows:
1 - capture accurate address of a location in a AddLocationComponent, store it in MongoDB
2 - display a pin of the location on a map within a SinglePostComponent
Ideally another Component with a map of multiple locations near by would be an option.
Could someone please share some wisdom in regards what services/technologies/methods to use to solve this?
Many thanks in advance!
For Capturing the address first you need to get the latitude , longitude using geocodeLatLng(geocoder, map, infowindow); and then for formatted address i.e to get the address as normal string you need to use
infowindow.setContent(results[0].formatted_address); follow this for your result hope it helps refer link

Drupal 7 Content type restrictions

How to add a restriction or validation for a content type that can be add only one content.
ex - Hotel web site room listing page should have only one content. After added once that only can edit or delete.
(I am a beginner for the Drupal)
Have you checked Node Limit module? I have never used it, but seems suitable for what you want to get.
Hope it helps.

Drupal OpenLayers how to solve : The layer cannot be reprojected to the map projection: EPSG:

Here is my adventure. On this page I would like to display our bicycle route.
I am using in drupal 7:
Openlayers 7.x-2.0-beta3
OpenLayers KML Layer 7.x-1.0-beta1 (I'm not sure if I need this module as well)
layer: openlayers_kml_example with the source a url to a file.
map : example_kml Example KML Map
The result is that the layer is displayed very very small on the big map. So if you zoom in to the airplane eventually you can see the track.
Map Projection set to 3857
Display Map Projection set to 4326 (the KML is made with Google earth. I think not important as there is no interaction only displaying.
LAYER SPECIFIC OPTIONS FOR KM extract styles and attributes ON.
If I put tracks on then I will miss the nice airplane icon.
I keep getting the same logs and of course no display on the page:
MESSAGE The layer cannot be reprojected to the map projection: EPSG:
MESSAGE Notice: Undefined variable: map in openlayers_layer_sanity_check() (line 399
MESSAGE Notice: Undefined property: stdClass::$name in openlayers_layer_sanity_check()
As it is not nice for people to think that I'm cycling constantly in water I would like to solve it :-)
Any suggestions?
John is correct in describing the issues but here is the solution :-)
Update drupal module openlayers to the latest version, currently 7.x-2.0-beta9.
Take care of the needed dependencies.
I reset all my layers and maps to the orginial and then adjusted the source of the kml layer to a file.

Drupal 7 alter node display

I have a content type with two image fields, banner and logo.
I am trying to implement logic which will allow one of the two to display depending on whether an editor elected to display just the banner or just the logo from radio button options.
I setup a small custom module implementing hook_node_view and tried to unset the image field from the node object but no joy. Code fragment below:
function mymodule_node_view($node, $view_mode, $langcode){
unset($node->field_main_picture[$node->language][0]);
unset($node->field_main_picture);
$node->field_main_picture = null;
}
None of those attempts worked.
I found the answer to my question.
The node object contains an array called content which is the renderable data Drupal will print to screen.
It's in that array that my unsets need to take place. I.E:
unset($node->content['field_main_picture']);
And the main picture image disappears.
I hardly suggest you to work with Devel module when you are programming like that. It allows you to display variables in your page and visualize the tree. For example, you can call dpm($node) function in your hook_node_view() to see what's in $node and how to access it.

click marker into a map instead of fill out the addressfield

I am using the openlayers addressfield, geocode and geofield modules in Drupal7 to let the users create content with relevant geodata. But for some content there is no streetname available. So i would like to have a prezoomed maparea where the user can click in and flag the right position, instead of typing in the addressfield.
I tried to use the geofield with the "Openlayers Widget Map", but it's not exactly what i need.
Does anybody know how to use the modules for that?
Is there a tutorial for that?
Kind Regards
Michi
thx for answering!
Yes, in theory it works. I tried it befor with the geofield module.
And yes, i could see the map in the contenttype form while creating a node.
But i havn't found a way to prezoom the map into relevant places (or use the geolocate bevahior for that) or change the marker style for that geofield map. The only mapstyle i can choose in the contenttype field setting is the "geofield widget map". So i have no choice to use an individual prezoomed map with own marker styles.
Changing the "OpenLayers Default Map" in the openlayers settings makes no difference.
So maybe i've overlooked something to customize the geofield, but the module has no configuration link. So without some more configurations, the module is not practicable for users to flag a node with geofield.
Any other ideas or informations?
You can do this with the Geofield module: http://drupal.org/project/geofield
When you enable that module, you can add a Geofield field on your content type and set the widget to be an 'Openlayers Map'... the geofield field lets you input geographic information in a variety of ways, but just clicking on a map is one way. It probably uses the default zoom and center you have saved for your Openlayers map.
Try that out and let us know if it worked!!
Here are the options for entering in address information via Geofield:

Resources