I am trying to: Update street addresses for entities in my directory
Link to a page where the issue can be seen: lien caché
I expected to see: A map marker for Greensburg Fire Department, at its new location
Instead, I got: A proper view with 10 results, but only 9 map markers. The marker for the Greensburg Fire Department no longer exists at either its old or new location.
I switched from Google Maps to OSM a few months ago once you made that option available.
I have one other department in another County that also has been edited, and it also now is missing its marker.
I believe these are the only 2 updates since I made the switch.
Of note: the individual Department page also lost its maps marker originally, but I was able to set lat/long coordinates to override the street address, and the marker does now show on the individual page:
lien caché
However, the marker does not appear on its District 10, Decatur County or Statewide maps.
The other Department experiencing the issue:
lien caché
The map appears on this page, with the lat/long override, but it does not appear on the District 14, Jackson County, or Statewide maps.
Hi,
Welcome to Toolset support. Am I correct to assume that if the address used the issue of markers shows and when the Lang/Lat is used the issue is not there?
Would you please do as follows?
Make sure you update Toolset to the latest version.
https://toolset.com/account/downloads/
After that please test by adding a new view and using the map there. It might be that there is a problem with the difference between the old view and the new codebase.
Thanks.
Christopher, thank you for the reply. You are helping me think through this. I built this site in 2018 and haven't had this problem previously, but your final thought "difference between the old view and the new codebase" got me to consider this in a different way.
I still don't have it figured out, but I am looking more closely at content template for the loop.
Right now I am just looking at the loop that generates the "District" map:
The two examples with missing map markers:
lien caché - "Greensburg" is in the listing but not the map
lien caché - "Hamilton Twp. Fire Dept." is in the listing but not the map
Here is the code I'm using for this content template. The opening div represents the listing at the top, which is fine. Then comes the wpv-map-marker shortcode, which appears to be the issue.
<div class="col-sm-6 sws">[wpv-post-title] ([types field='city'][/types])</div>
[wpv-map-marker map_id="map-3" marker_id="marker-[wpv-post-id]" address="[wpv-conditional if='( $(wpcf-address-override) ne "" )'][types field='address-override' format='FIELD_LATITUDE, FIELD_LONGITUDE'][/types][/wpv-conditional][wpv-conditional if='( $(wpcf-address-override) eq "" )'][types field='address1'][/types][/wpv-conditional] [types field='city'][/types] IN [types field='zip' format='FIELD_NAME: FIELD_VALUE'][/types]" marker_title="[wpv-post-title]" marker_icon="lien caché" marker_field='[wpv-post-title]' background_color="#ffffff"]<h4>[wpv-post-link]</h4>[types field='address1'][/types]<br />[types field='city'][/types] IN [types field='zip' format='FIELD_VALUE'][/types][/wpv-map-marker]
One thing I'm noticing - I have two conditions in the address field, for "ne" and "eq". Is it possible that there is a third status that is affecting these two posts which have been modified? Is there a way to do an "else" statement instead of just two opposite "if" statements?
This is my working theory on why the map marker isn't showing. Somehow these posts don't equal "", but also don't not equal "".
If we can get one of these maps to work, I think I should be able to fix the others in the same way.
Thank you for your help!
Hi,
Thank you for your answer. Let me see if I can point out some information that might help you here.
- With OSM, the geocoder is more picky. Passing a mixed “address” like
"[address1] [city] IN [ZIP: 47240]" often fails (labels like IN and FIELD_NAME: confuse it).
- Edited posts vanish because their marker gets re-geocoded now (OSM) and the new address string can’t be parsed, so no coordinates → no marker. Old, unedited posts still use cached coords.
- Lat/Lon inside address: Feeding "LAT, LON" via the address= attribute worked with Google in some cases, but for OSM you should provide lat and lon attributes explicitly.
I suggest that you use both lat/lon (from your override) and a clean address (no labels, no “IN”) in the same marker. If lat/lon exist, Toolset uses them; otherwise it geocodes the address.
As an example:
[wpv-map-marker
map_id="map-3"
marker_id="marker-[wpv-post-id]"
lat='[types field="address-override" format="FIELD_LATITUDE" output="raw"][/types]'
lon='[types field="address-override" format="FIELD_LONGITUDE" output="raw"][/types]'
address='[types field="address1" output="raw"][/types], [types field="city" output="raw"][/types], [types field="state" output="raw"][/types] [types field="zip" format="FIELD_VALUE" output="raw"][/types], USA'
marker_title='[wpv-post-title]'
marker_icon='<em><u>lien caché</u></em>'
]
<h4>[wpv-post-link]</h4>
[types field='address1' output='raw'][/types]<br />
[types field='city' output='raw'][/types], [types field='state' output='raw'][/types]
[types field='zip' format='FIELD_VALUE' output='raw'][/types]
[/wpv-map-marker]
For your last question:
There isn’t a native “else” in [wpv-conditional], so use complementary conditions.
Something like this:
[wpv-conditional if="( $(wpcf-address-override) ne '' )"]
[wpv-map-marker map_id="map-3" marker_id="marker-[wpv-post-id]"
lat='[types field="address-override" format="FIELD_LATITUDE" output="raw"][/types]'
lon='[types field="address-override" format="FIELD_LONGITUDE" output="raw"][/types]']
...popup...
[/wpv-map-marker]
[/wpv-conditional]
[wpv-conditional if="( $(wpcf-address-override) eq '' )"]
[wpv-map-marker map_id="map-3" marker_id="marker-[wpv-post-id]"
address='[types field="address1" output="raw"][/types], [types field="city" output="raw"][/types], [types field="state" output="raw"][/types] [types field="zip" format="FIELD_VALUE" output="raw"][/types], USA']
...popup...
[/wpv-map-marker]
[/wpv-conditional]
Hope I could help by clarifying the points above.
Thanks.