AIFDR / riab

Risk in a Box - main project
Other
17 stars 6 forks source link

Feature info doesn't work on some layers #177

Closed uniomni closed 13 years ago

uniomni commented 13 years ago

Some vector layers, when uploaded to Risiko don't show any features when clicked on. Checking with GeoServer show that the features are there.

Maybe a bug in the feature info functionality?

I will send test data separately.

uniomni commented 13 years ago

Even though the shapefile shows up fine in Qgis and GeoServer, I noticed it has missing values and can't help wondering if the way they are represented could be the cause of this problem?

uniomni commented 13 years ago

No, just verified that other datasets e.g. OSM building footprints have None for missing values and that works fine.

ahocevar commented 13 years ago

What are the names of the layers in question? Also, if you open the network pane of your browser's debugger, what is the GetFeatureInfo url and the response from the server?

uniomni commented 13 years ago

The layer is called demo_sekolah (it comes from the shape file I mailed). I am not sure how to issue a GetFeatureInfo url - can you help? The main URL is http://127.0.0.1:8000/impact/

ahocevar commented 13 years ago

The GetFeatureInfo request is issued as soon as you click on the map with the (i) button pressed.

uniomni commented 13 years ago

OK - I got Firebug open and selected the Net pane. Cleared everything and clicked on the feature. This gives two lines in the debugger with the responses:

301 MOVED PERMANENTLY 200 OK

uniomni commented 13 years ago

And pasting the URL generated in, gives what is shown below. Clearly the features are there although not shown. Is there something in there that would cause problems (such as spaces)?

Response (Markdown bungles this, so look at the raw string):

<?xml version="1.0" encoding="UTF-8"?>gml:boundedBygml:nullunknown/gml:null/gml:boundedBygml:featureMembergeonode:the_geom100.64722,-0.86356/gml:coordinates/gml:Point/geonode:the_geomSekolah</geonode:Jenis Obye>geonode:LantaiKeramik/geonode:Lantaigeonode:Bangunan1550/geonode:Bangunangeonode:No83/geonode:Nogeonode:Jumlah_Gur44/geonode:Jumlah_Gurgeonode:Sumber_AirPDAM/geonode:Sumber_Airgeonode:Jam11:17:22/geonode:Jamgeonode:Tanggal12/05/2011/geonode:Tanggalgeonode:WaypointS3A-065/geonode:Waypointgeonode:Level_SekoSMA/geonode:Level_Sekogeonode:Kelompok3/geonode:Kelompokgeonode:Tingkat1/geonode:Tingkatgeonode:Alat_PMKTidak Ada/geonode:Alat_PMKgeonode:AksesibiliMotor, Mobil, Truk/geonode:Aksesibiligeonode:Total_Muri504/geonode:Total_Murigeonode:AtapSeng/geonode:Atapgeonode:Juml_Ruang31/geonode:Juml_Ruanggeonode:Halaman8450/geonode:Halamangeonode:Total_Guru67/geonode:Total_Gurugeonode:Telepon_KaAda/geonode:Telepon_Kageonode:Jumlah_Mur163/geonode:Jumlah_Murgeonode:KecamatanGunung Talang/geonode:Kecamatangeonode:DindingTembok/geonode:Dindinggeonode:Struktur_BBeton Bertulang/geonode:Struktur_Bgeonode:Jumlah_Gur123/geonode:Jumlah_Gur1geonode:Sinyal_HPAda/geonode:Sinyal_HPgeonode:Lintang-0.86356/geonode:Lintanggeonode:Daya> 2200/geonode:Dayageonode:MCKAda/geonode:MCKgeonode:Jumlah_MCK12/geonode:Jumlah_MCKgeonode:No_Telp0755-7333270/geonode:No_Telpgeonode:NagariCupak/geonode:Nagari9422-9424</geonode:No. Foto>geonode:Bujur100.64722/geonode:Bujur341</geonode:Juml. Muri>geonode:Nama_ObyekSMAN 1 Gunung Talang/geonode:Nama_Obyekgeonode:Juml_Pintu1/geonode:Juml_Pintugeonode:JorongPasar Usang/geonode:Jorong/geonode:demo_sekolah/gml:featureMember/wfs:FeatureCollection

ahocevar commented 13 years ago

The problem with this layer is that it has an attribute with a blank in the name (Jenis Obye). Attribute names shall never have blanks in them, because blanks are invalid in XML node names. My recommendation would be to use an underscore instead.

uniomni commented 13 years ago

Thanks heaps - I shall make Risiko always substitute blanks in attribute names with underscores and close this ticket when done.

uniomni commented 13 years ago

Work around when generating shp files done in changeset: https://github.com/AIFDR/riab/commit/da3b26a1bffc2d9e488083630288c7da535fdbaa

However, it does not address

  1. Why these layers show up fine in Qgis and more surprisingly in GeoServer's layer preview where we indeed can click and see the features including spaces and all
  2. How to catch the issue and provide an error message for such datasets.
ahocevar commented 13 years ago

Re 1: As long as we request images (GetMap) and HTML (GetFeatureInfo with text/html output format, which is done in the GeoServer layer preview) only, everything will be fine. Any XML based output (GML in our case) will fail.

Re 2: It may not be necessary to fail on such layers. Instead, it could be enough to customize the schema in the GeoServer data directory by replacing blanks with e.g. underscores in attribute names. Needs more investigation.

ahocevar commented 13 years ago

Did some investigation and schema mapping won't help us here. A quick solution would be to use ogr2ogr on the uploaded file, before registering it in GeoServer. See http://darrencope.com/2011/04/26/renaming-fields-in-a-shapefile/. A long-term solution would be to address this as part of the GeoServer uploader improvements that OpenGeo is currently working on.

uniomni commented 13 years ago

Thanks for the investigation. We can easily change the shp files here for the problem at hand but it worries me for the longer term that otherwise 'valid' shapefiles may cause this behaviour without feedback to the user. Perhaps GeoNode should raise an exception or do the replacement when blanks are encountered. I hope this issue will be flagged in the GeoNode uploader development. Many thanks

uniomni commented 13 years ago

Closing this issue as far as Risiko is concerned but raised the issue in the documentation: https://github.com/AIFDR/riab/blob/develop/docs/usage/gotchas.rst