jghazally / quakemonitor

A play with GeoNet.co.nz json API for latest quakes
0 stars 0 forks source link

Map not working #1

Open Wolfie57 opened 7 years ago

Wolfie57 commented 7 years ago

Hi jghazally Recent eq activity got me looking, found your script, but have an issue. Map won't kick in, "Ooops" msg. Js console hilites "TypeError: d is undefined . . . common.js:"

I have my learners PHP ticket, but JS is still a total mystery. Any thoughts? Cheers

evilbudz commented 6 years ago

i to could not get to work, here is my index.php , witch is working fine now see at https://www.nzquakes.maori.nz

<!–– use code after this <?php include_once('config.php');

if ( !empty($_GET['ajax']) ) { // OK cool - then let's create a new cURL resource handle $ch = curl_init();

// Now set some options (most are optional)

// Set URL to download
curl_setopt($ch, CURLOPT_URL, 'https://www.geonet.org.nz/quakes/services/all.json');

// Include header in result? (0 = yes, 1 = no)
curl_setopt($ch, CURLOPT_HEADER, 0);

// Should cURL return or print out the data? (true = return, false = print)
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Timeout in seconds
curl_setopt($ch, CURLOPT_TIMEOUT, 30);

// Download the given URL, and return output
$output = curl_exec($ch);

// Close the cURL resource, and free system resources
curl_close($ch);

echo $output;
die;

} ?> ––> <!DOCTYPE html>

NZ Quakes | Earth Quakes in New Zealand

Strongest Earth Quake:
M - @


Click Here for Support
Copyright 2014 - 2018 | NZ Quakes
jghazally commented 6 years ago

Hi @evilbudz I just checked the link: https://www.nzquakes.maori.nz/ Everything seems to be working on chrome?

evilbudz commented 6 years ago

sorry yes was to help that dude out i should have stated more clearly, i had to modify the script abit to get it to work but seems to work now just cant figure out how to resize the map lol its prob realy easy too

jghazally commented 6 years ago

What was it you had to change? Mind doing a Pull request? No worries if not. Happy it helped. Haven't looked at this in 5 years. Might have to revisit it. If you haven't figured it out yet, To change the zoom and centre of the map you'll need to change the map options: Scripts/main.js you'll want to check the gmaps documentation here To resize the map on the page you'll want to check the css styles: css/screen.css Specifically the #map section.

Good luck!

Wolfie57 commented 6 years ago

Hi Guys, "that dude" here. I deleted my bookmark for this last week, so typical !! Many thanks for the posts, & yep https://www.nzquakes.maori.nz/ working swell in old Firefox too. Something to play with this weekend. Cheers

evilbudz commented 6 years ago

mean i got everything to work now that i can see, i added a few extra things dont know how the get the name of place where eq was though any ideas

evilbudz commented 6 years ago

the script may work as is, but as it just does not seem to want to use the include_once for the config.php hence why i put it in manually instead of the php code to do it, maybe my hosting not allow it

Wolfie57 commented 6 years ago

Yep, the map will display if you use a text key in place of a defined thing. From what I found a hyphen in the key is stuffing that up, hyphens don't work in variables or defines apparently. So 1 step forward, but still no quake data showing so far. Battling on!

evilbudz commented 6 years ago

email me tvercoe @ live.co.uk i will send you what i have as i found i have had to use full web address don't know why i am guessing it is my hosting provider

Wolfie57 commented 6 years ago

have done, cheers

evilbudz commented 6 years ago

did ya get the file?

Wolfie57 commented 6 years ago

just checked & Yep, thanks bud

evilbudz commented 6 years ago

hey jghazally, any reason why the timer would display a - symbol in front of the time or is this a geonet error, EDIT omg what a muppet i am it was my pc date and time was changed does this all the time

evilbudz commented 6 years ago

would you happen to know or anyone else what the address is for the full list of quakes? as i can only fint the all.json and the felt.json files, some website (http://www.christchurchquakemap.co.nz/faq) refrences to this full list but does not say where or how to get it, the reason i want this file is it is the full list and is not displayed on there website to public and has all recent ones icluded

Wolfie57 commented 6 years ago

Hey evilbudz, check out the following . . https://www.geonet.org.nz/data/types/eq_catalogue http://api.geonet.org.nz/ Cheers Power outage today so no chance for a fiddle, & still no eq data

evilbudz commented 6 years ago

am going to try and pass (curl_setopt($ch, CURLOPT_URL, 'http://wfs.geonet.org.nz/geonet/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=geonet:quake_search_v1&maxFeatures=50&outputFormat=json) instead of of the (curl_setopt($ch, CURLOPT_URL, 'https://www.geonet.org.nz/quakes/services/all.json)

evilbudz commented 6 years ago

seems to work except it display NaN for hours min and seconds lol

evilbudz commented 6 years ago

here is what i have, works if use other curl call to the actual all.json file and also notice when call the other way it does not have the inesity

evilbudz commented 6 years ago

have you tried to load what i gave you? that should work if not maybe your hosting provider is blocking something

evilbudz commented 6 years ago

i am guessing i have to alter the JS file in order for it to use the new id's damn it this is all new to me and very easy stuff seems so hard lol