Skip Navigation

[Resolved] Longitude and Latitude is not transferred correctly

This support ticket is created 2 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Waqar 2 years, 3 months ago.

Assisted by: Waqar.

Author
Posts
#2255007
Bildschirmfoto 2021-12-30 um 00.12.49.png
Bildschirmfoto 2021-12-29 um 22.56.01.png
Bildschirmfoto 2021-12-29 um 22.58.04.png
Bildschirmfoto 2021-12-29 um 23.33.58.png

Tell us what you are trying to do?
- I have a gravity form, which saves form entries to a custom post type. It is important, that we are able to collect longitude and latitude, as there is not always an address (we collect data for development projects.
As the custom field, that you offer for the Custom Post type, stores an address, the mapping gies wrong and somehow toolset creates wrong longitudes and latitudes.

Is there any documentation that you are following?
- pls See screenshots

Is there a solution for this issue? How can I collect longitude and latitude correctly with toolset?

Regards and thanks
Jutta

#2255229

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Jutta,

Thank you for contacting us and I'd be happy to assist.

The way Toolset's address type custom field works, it stores the human-readable textual address as a value in the custom field and stores the relevant longitude and latitude coordinates in a special database table "{table_prefix}toolset_maps_address_cache".

Is there any specific reason that you're using the Gravity Form for this data collection and not the Toolset Form?

If for some reason, the use of the Gravity Form is important, you can divide the data collection process into two steps. First, a gravity form can be used to collect the basic information (except the location) about the post, and next a Toolset Form can be used to collect the address/location for the same post.

regards,
Waqar

#2255237

Hi Waquar,

thanks for your assistance!
I am collecting this data with gravityforms, as it is a survey with about 20 questions. They are all about city development and area development. Sure, I could divide it in two steps, but how can use toolset to store a pinpoint, not an address?
Pls have a look at the screenshots above. the example shows the pinpoint of a lake, with longitude and latitude, but no address. once these values are stored to toolset, toolset tries to lookup both in an address database? However, it creates wrong longitude and latitudes. What I want, from gravity or from toolset, is a form that allows the user to track the pinpoint wherever he or she likes. (see new attached screenshot). Can I do this with toolset? I do not know how, see my reply to https://toolset.com/forums/topic/how-to-add-a-map-to-a-form-which-appears-by-default/.

So there are two questions:
1. how can I use toolset form to allow persons to Ann a pinpoint, without entering an address? This is my first ticket.
2. how can my toolset cpt store correctly the longitude an latitude, it gets from gravity forms?

Concerning the latter, the gf developer tries to help as well. He wants to know:
- What is the structure of the "wpcf-geodaten" custom field? Is it an array that contains both the latitude and longitude? Is the value of this field supposed to be a serialized array?
Could you answer this please?

Regards

#2255893

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for writing back.

1. I understand that the answer to your first question has been covered in my reply to your other ticket.
( ref: https://toolset.com/forums/topic/how-to-add-a-map-to-a-form-which-appears-by-default/#post-2255849 )

2. Suppose you have an address type custom field with slug "post-address". Here is some background information on how the Toolset address type field stores information:

a). The postmeta table for custom fields:

If you'll type in some address in the field and save, the human-readable text/address will be saved in the custom field table ( i.e. {table_prefix}postmeta ) with the key "wpcf-post-address".

For example:
"New York, NY, USA"

On the other hand, if you've used the drag & drop pin on the map to select the exact location, instead of the human-readable text/address, the latitude and longitude of that pin will be saved in the custom field table, in the format: {latitude,longitude}.

For example:
"{40.71238464658969,-73.99121012158203}"

b). The Toolset's special table for the map cache:

As mentioned in the previous reply, Toolset stores the actual location latitude and longitude coordinate in a special table "{table_prefix}toolset_maps_address_cache". Using this approach a local cache of coordinates is maintained in the database, which saves the number of calls to Google Maps geolocation API, which in turn saves the API billing cost, exponentially.

Whenever a custom field value is saved in an address type field, the system checks whether a record for its coordinates already exists in this map cache table or not. If it doesn't exist, its record is added to the map cache table and if it exists, no duplicate record is added. The latitude and longitude information for each record is saved in this table in the "Point" (geometry data type) format.

I hope this background information will help you and the Gravity Form developer and let me know if you have any follow-up questions.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.