geomoose / gm3

GeoMoose 3.0 Development. Please submit pull requests to the 'main' branch.
https://www.geomoose.org
MIT License
58 stars 59 forks source link

Identify, Select fail on geojson mapsources when property is null #652

Open brentfraser opened 3 years ago

brentfraser commented 3 years ago

At least I think that is the problem. To test use geojson files in https://github.com/geomoose/gm3-demo-data/pull/8

theduckylittle commented 2 years ago

Can you get me some more details here? I've tried corrupting a few files in order try to recreate. I tried:

When I eliminate all properties, the feature does not render at all, which is maybe expected?

brentfraser commented 2 years ago

Hmm, yes I should have supplied more details. So here's what i did today:

  1. load a GeoMoose site with a sketch layer with an upload tool.
  2. Upload gm3-demo-data/demo/census/census_cities.geojson file
  3. Do Identify on "Farmington" polygon
    • Note no feature is found (bad, I expected to find one feature and show properties) The other city polygons work as expected.
brentfraser commented 2 years ago

Looking at the census_cities.geojson in a text editor , all the properties for Farmington look ok (and no nulls), so I'm not sure why it fails.

brentfraser commented 2 years ago

Looks like it is bad (?) geometry for the holes in the Farminton polygon. Looking at the ogr2ogr command I used (https://github.com/geomoose/gm3-demo-data/tree/main/demo/census), I may need to specify -nlt MULTIPOLYGON

theduckylittle commented 2 years ago

Digging in a little, I'm seeing the queryVectorLayer function return no features from OpenLayer's forEachFeatureAtCoordinateDirect call. Since other features work, I don't believe there to be a mismatched projection issue, and could be due to the malformed Geometry. But it's a bug in OpenLayers that we would need to investigate (locally I have version 6.9.0 installed).

brentfraser commented 2 years ago

In the mean time, I'm OK with just saying to users "make sure your geometry is valid"

brentfraser commented 2 years ago

and I thought I had filed an Issue on "Can't do identify on point or line in Drawing and Markup". Maybe it's buried in another Issue...

theduckylittle commented 2 years ago

It looks as if we drop the -nlt Polygon from the creation script, all is well.

Should we create a separate MR to fix our data? I suspect that this is garbage-in-is-garbage-out and there won't be much of a way for us to assist the user in that case.

brentfraser commented 2 years ago

Yes, I need to fix it and do a PR.

brentfraser commented 2 years ago

Looking at the history of the files in gm3-demo-data, i had originally used MULTIPOLYGON, but after loading the data into GeoServer inserts were a problem.

theduckylittle commented 2 years ago

:thinking: That's interesting. I would think it would have an issue with mixed types (say Polygons and MultiePolygons) but usually a single time doesn't phase it.

brentfraser commented 2 years ago

It could have been GM was telling it to insert a POLYGON and GeoServer expected MULTIPOLYGON only? Maybe there is a "promote geometry" switch in GeoServer...