Skip Navigation

[Resolved] Display random longitude and latitude on google map

This support ticket is created 6 years, 5 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.

Our next available supporter will start replying to tickets in about 1.55 hours from now. Thank you for your understanding.

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/Hong_Kong (GMT+08:00)

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by Jeffrey 6 years, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#908021

Just keep holding that ticket https://toolset.com/forums/topic/display-a-random-address-on-google-mao/

Could you please help me to revise that piece of code to make the longitude and latitude randomly, so that the markers on google map will be within a proper range. please just make longitude and latitude randomly after 2 digits of the decimal point

for example

Longitude -122.351110 be random from 1110
Latitude 47.619746 be random from 9746

Thank you so much!

#908114

Hello,

There isn't such a built-in feature within Toolset maps plugin, and it needs custom codes, and it will take effect on the google map, and it might produce other unexpected result, please confirm it, if you still need assistance for it, please backup your website, I can setup a demo codes in it.

#908656

Sure, please implement your code, I have made a backup copy. Thanks

#908788

OK, I am checking it in your website, will feedback if there is anything found

#909184

按照你的要求我已经修改了php代码:
hidden link
使用该custom shortcode的方法如下:

<p>原先的LATITUDE:[types field='my-location' format="FIELD_LATITUDE"][/types]</p>
<p>原先的LONGITUDE:[types field='my-location' format="FIELD_LONGITUDE"][/types]</p>
<hr />
<p>生成的新LATITUDE:[random_address][types field='my-location' format="FIELD_LATITUDE"][/types][/random_address]</p>
<p>生成的新LONGITUDE:[random_address][types field='my-location' format="FIELD_LONGITUDE"][/types][/random_address]</p>

见结果页面:
hidden link

#909271

我将这段代码插入 marker的简码中的 lon='' 和 lat="" 运行的非常好,非常非常的感谢!!!:)