Skip to content

Instantly share code, notes, and snippets.

@ingenieroariel
Created October 19, 2010 15:14
Show Gist options
  • Save ingenieroariel/634360 to your computer and use it in GitHub Desktop.
Save ingenieroariel/634360 to your computer and use it in GitHub Desktop.
from geoserver.catalog import Catalog
from geonode import settings
user, password = settings.GEOSERVER_CREDENTIALS
url = "http://localhost:8001/geoserver-geonode-dev/rest"
cat = Catalog(url, user, password)
print "Connected to GeoServer, about to get resources"
resources = cat.get_resources()
print "Got %d resources" % len(resources)
fixed =0
for resource in resources:
print resource
if resource.projection is None:
print "This resource has to be fixed, setting 4326 and latlon=native"
resource.projection = "EPSG:4326"
resource.latlon_bbox = resource.native_bbox
cat.save(resource)
fixed +=1
else:
print "Projection %s" % resource.projection
print
print "Fixed %d resources" % fixed
(git)geonode@host:~/tmp$ python fixbbox.py
Connected to GeoServer, about to get resources
Got 54 resources
CoverageStore[geonode:sfdem] :: sfdem
Projection EPSG:26713
DataStore[base:station_ll] :: station_LL
Projection EPSG:4326
DataStore[base:ht_landuse_utm] :: HT_landuse_UTM
Projection EPSG:32618
DataStore[base:chef_lieu_communal] :: Chef_Lieu_Communal
This resource has to be fixed, setting 4326 and latlon=native
DataStore[base:hti_sea_py] :: hti_sea_py
Projection EPSG:32618
DataStore[base:cote] :: Cote
Projection EPSG:32618
DataStore[base:landslides_utm] :: Landslides_UTM
Projection EPSG:32618
DataStore[base:health_facilities1_project] :: health_facilities1_Project
Projection EPSG:32618
DataStore[base:station_utm] :: station_UTM
Projection EPSG:32618
DataStore[base:zone_propice_inondation_100000] :: Zone_Propice_Inondation_100000
Projection EPSG:32618
DataStore[base:hti_wetlands_tnc_py] :: hti_wetlands_TNC_py
Projection EPSG:32618
DataStore[base:principaux_bassins_versant] :: Principaux_Bassins_Versants
This resource has to be fixed, setting 4326 and latlon=native
DataStore[base:hti_cont50m_srtm_pl_project] :: hti_cont50m_srtm_pl_Project
Projection EPSG:26718
DataStore[base:limites_commune] :: Limites_Communes
Projection EPSG:32618
DataStore[base:roads_utm] :: Roads_UTM
Projection EPSG:32618
DataStore[base:camps_21100305f] :: camps_21100305F
Projection EPSG:4326
DataStore[base:zone_propicie_inondation_100000] :: zone_propicie_inondation_100000
Projection EPSG:32618
DataStore[base:menace_exceptionnelle_region] :: menace_exceptionnelle_region
Projection EPSG:32618
DataStore[base:20100224_ocha_shelter_site] :: 20100224_OCHA_shelter_sites
Projection EPSG:32618
DataStore[base:licuefact_utm] :: Licuefact_UTM
Projection EPSG:32618
DataStore[base:limites_sections_communale] :: Limites_Sections_Communales
This resource has to be fixed, setting 4326 and latlon=native
DataStore[base:grand_bassin_versant] :: Grand_Bassin_Versant
This resource has to be fixed, setting 4326 and latlon=native
DataStore[base:route] :: Route
Projection EPSG:32618
DataStore[base:hti_lak_uk_pyp] :: hti_lak_uk_pyp
Projection EPSG:32618
DataStore[base:occupation_98] :: Occupation_98
Projection EPSG:32618
DataStore[base:roads_ll] :: Roads_LL
Projection EPSG:4326
DataStore[base:hti_riv_topo50_pl] :: hti_riv_Topo50_pl
Projection EPSG:32618
DataStore[base:implantation_camps_pa] :: implantation_camps_pap
This resource has to be fixed, setting 4326 and latlon=native
DataStore[base:litho_fact] :: Litho_fact
This resource has to be fixed, setting 4326 and latlon=native
DataStore[base:chef_lieu_departemental_haiti_font_point] :: Chef_Lieu_Departemental_Haiti_font_point
This resource has to be fixed, setting 4326 and latlon=native
DataStore[base:pfloodarea] :: PFloodAreas
Projection EPSG:32618
DataStore[base:hti_hydroname_tnc_pt] :: hti_hydroname_TNC_pt
Projection EPSG:32618
DataStore[base:erosion] :: Erosion
This resource has to be fixed, setting 4326 and latlon=native
DataStore[base:inonda] :: INONDA
This resource has to be fixed, setting 4326 and latlon=native
DataStore[base:hti_topo_tnc_pt] :: hti_topo_TNC_pt
Projection EPSG:32618
DataStore[base:localisation_gli] :: localisation_gliss
Projection EPSG:32618
DataStore[base:fleuve] :: fleuve
This resource has to be fixed, setting 4326 and latlon=native
DataStore[base:country] :: country
This resource has to be fixed, setting 4326 and latlon=native
DataStore[base:menace_frequente_region] :: menace_frequente_region
Projection EPSG:32618
DataStore[base:menace_rare_region] :: menace_rare_region
This resource has to be fixed, setting 4326 and latlon=native
DataStore[base:limites_departement] :: Limites_Departements
Projection EPSG:32618
CoverageStore[base:dem_H30] :: dem_H30
Projection EPSG:32618
CoverageStore[base:frrel30] :: frrel30
Projection EPSG:32618
CoverageStore[base:gliss_MV] :: gliss_MV
Projection EPSG:32618
CoverageStore[base:Carte_Topographique_Bloc1_B] :: Carte_Topographique_Bloc1_B
Projection EPSG:32618
CoverageStore[base:psus_glisse] :: psus_glisse
Projection EPSG:32618
CoverageStore[base:menace_int1] :: menace_int1
Projection EPSG:32618
CoverageStore[base:psismi1] :: psismi1
Projection EPSG:32618
CoverageStore[base:Carte_Topographique_Bloc1_A] :: Carte_Topographique_Bloc1_A
Projection EPSG:32618
CoverageStore[base:SLOPE30] :: SLOPE30
Projection EPSG:32618
CoverageStore[base:rrel30] :: rrel30
Projection EPSG:32618
CoverageStore[base:Carte_Topographique_Bloc1_C] :: Carte_Topographique_Bloc1_C
Projection EPSG:32618
CoverageStore[base:Carte_Topo50_Haiti] :: Carte_Topo50_Haiti
Projection EPSG:32618
CoverageStore[base:IMM500] :: IMM500
Projection EPSG:32618
Fixed 12 resources
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment