firstly, i had the json data decode and show all the data in label.
secondly, i use for each loop to get the data i want and show them in another label in order.
there are no problem from above.
but when i try to use map.CreateMarker in the loop , i get error
To CreateMarker, your geocoordinates must be in geographic format (decimal latitude, longitude format).
Your data is in WGS84 format and in degrees,minutes,seconds. Fore example 20:00",“SiteName”:“花蓮”,“UVI”:“0.00”,“WGS84Lat”:“23,58,30”,“WGS84Lon”:“121,36,48”}] (degrees,minutes,seconds)
As an example, convert 23,58,30 to 23.9750000000 deg. latitude
and 123,36,48 to 123.6133333333 deg. longitude.
The geocoordinates must be entered in CreateMarker in decimal values . This conversion example assumes the Latitude is in the northern hemisphere and the longitude is degrees east.
There are conversion formulas to convert dd,mm,ss to decimal degrees and online converters
Thank you @SteveJG , i’ve tried another file with the correct format , it works!
But the markers created by above method does not have the properties like infobox …etc. is it possible to add infobox to those marker? and also have the same event like when marker.click?
Very good. I am glad you found a data set using decimal geocoordinates.You also could have written a small Procedure to convert the dd,mm,ss to decimal ...
Yes it is possible to add an infobox from the geojson information. The CreateMarkers only creates a Marker at the location. The National Parks tutorial demonstrates how to plot multiple run time markers using a csv file to an OpenStreetMap and how to create and populate the info box. Use the ideas there by selecting the items from the geojson data stream (similar to how you isolated the latitude and longitude) to provide what you want (perhaps location and UIV number) in the infobox. Instead of the csv, use the topics parsed from the geojson.
Yes, you will be able to click the marker to get the popup. Try the tutorial and see how it works. It is probably what you want to do.
Thanks for letting us know @anna770822 This was made converting the WGS84 latitude/longitude dd,mm,ss to decimal degrees on the fly with internal Block code