Created
September 25, 2020 23:10
-
-
Save categulario/77a3b0e5f8fde88a1dd6acc11cb28a78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
import pandas | |
from pandas.io.json import json_normalize | |
import geopandas as gpd | |
import matplotlib.pyplot as plt | |
url = "https://smn.conagua.gob.mx/tools/PHP/sivea/siveaEsri2/php/temp_genjson.php?per=T3" | |
resp = requests.get(url) | |
data = resp.json() | |
puntos = json_normalize(data) | |
geopuntos = gpd.GeoDataFrame(puntos, geometry = gpd.points_from_xy(puntos.longitud.astype(float), puntos.latitud.astype(float))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import geopandas as gp | |
import fiona | |
import matplotlib.pyplot as plt | |
fiona.drvsupport.supported_drivers['kml'] = 'rw' | |
fiona.drvsupport.supported_drivers['KML'] = 'rw' | |
gdf = gp.GeoDataFrame() | |
for i in range(1,32): | |
try: | |
temp = gp.read_file("https://clima.inifap.gob.mx/img/img/img/kml/estados/%s.kml" % i) | |
gdf = gdf.append(temp) | |
except: | |
pass | |
gdf.plot() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment