Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #4827 - Line layer uploaded to GeoNode is rendered as a point layer #4837

Closed
wants to merge 2 commits into from

Conversation

capooti
Copy link
Member

@capooti capooti commented Sep 6, 2019

This PR fixes #4827 - Line layer uploaded to GeoNode is rendered as a point layer

Checklist

Reviewing is a process done by project maintainers, mostly on a volunteer basis. We try to keep the overhead as small as possible and appreciate if you help us to do so by completing the following items. Feel free to ask in a comment if you have troubles with any of them.

For all pull requests:

  • Confirm you have read the contribution guidelines
  • You have sent a Contribution Licence Agreement (CLA) as necessary (not required for small changes, e.g., fixing typos in documentation)
  • Make sure the first PR targets the master branch, eventual backports will be managed later. This can be ignored if the PR is fixing an issue that only happens in a specific branch, but not in newer ones.

The following are required only for core and extension modules (they are welcomed, but not required, for contrib modules):

  • There is a ticket in https://github.com/GeoNode/geonode/issues describing the issue/improvement/feature (a notable exemptions is, changes not visible to end users)
  • The issue connected to the PR must have Labels and Milestone assigned
  • PR for bug fixes and small new features are presented as a single commit
  • Commit message must be in the form "[Fixes #<issue_number>] Title of the Issue"
  • New unit tests have been added covering the changes, unless there are explanation on why the tests are not necessary/implemented
  • This PR passes all existing unit tests (test results will be reported by travis-ci after opening this PR)
  • This PR passes the QA checks: flake8 geonode
  • Commits changing the settings, UI, existing user workflows, or adding new functionality, need to include documentation updates

Submitting the PR does not require you to check all items, but by the time it gets merged, they should be either satisfied or inapplicable.

@capooti capooti requested a review from afabiani September 6, 2019 01:15
@cla-bot cla-bot bot added the cla-signed CLA Bot: community license agreement signed label Sep 6, 2019
@afabiani
Copy link
Member

afabiani commented Sep 6, 2019

Uhm, did you understand what's happening? From the fix you are proposing I notice that basically it is just matter of refreshing the resource from GeoServer? Am I correct?
Could be this a side effect of a race condition on GeoNode or GeoServer not correctly configuring the layer somehow?

@capooti
Copy link
Member Author

capooti commented Sep 6, 2019

@afabiani nope, in this case the reason is that with previous code the gs_layer variable is never set when default style is None, therefore code can't go through the if block where we check jts.geom.
Having gs_layer being set outside of the "if _default_style" block fixes this.

@codecov
Copy link

codecov bot commented Sep 8, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@87961df). Click here to learn what that means.
The diff coverage is 60%.

@@            Coverage Diff            @@
##             master    #4837   +/-   ##
=========================================
  Coverage          ?   59.54%           
=========================================
  Files             ?      231           
  Lines             ?    12379           
  Branches          ?     1796           
=========================================
  Hits              ?     7371           
  Misses            ?     4400           
  Partials          ?      608

1 similar comment
@codecov
Copy link

codecov bot commented Sep 8, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@87961df). Click here to learn what that means.
The diff coverage is 60%.

@@            Coverage Diff            @@
##             master    #4837   +/-   ##
=========================================
  Coverage          ?   59.54%           
=========================================
  Files             ?      231           
  Lines             ?    12379           
  Branches          ?     1796           
=========================================
  Hits              ?     7371           
  Misses            ?     4400           
  Partials          ?      608

@afabiani
Copy link
Member

afabiani commented Sep 8, 2019

@capooti your change makes sense, and currently you might have identified a wong test case too

======================================================================
FAIL: test_layer_upload (geonode.tests.integration.NormalUserTest)
Try uploading a layer and verify that the user can administrate
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/virtualenv/python2.7_with_system_site_packages/local/lib/python2.7/site-packages/timeout_decorator/timeout_decorator.py", line 81, in new_function
    return function(*args, **kwargs)
  File "/home/travis/build/GeoNode/geonode/geonode/tests/integration.py", line 223, in test_layer_upload
    self.assertIsNone(get_sld_for(gs_catalog, saved_layer))
AssertionError: u'\n<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"\n  xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n  xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">\n  <NamedLayer>\n    <Name>san_andres_y_providencia_poi_by_norman</Name>\n    <UserStyle>\n    <Name>san_andres_y_providencia_poi_by_norman</Name>\n    <Title>san_andres_y_providencia_poi_by_norman</Title>\n      <FeatureTypeStyle>\n        <Rule>\n\n<PointSymbolizer>\n  <Graphic>\n    <Mark>\n      <WellKnownName>x</WellKnownName>\n      <Fill>\n        <CssParameter name="fill">#880088</CssParameter>\n      </Fill>\n      <Stroke>\n        <CssParameter name="stroke">#ffbbff</CssParameter>\n      </Stroke>\n    </Mark>\n    <Size>10</Size>\n  </Graphic>\n</PointSymbolizer>\n\n        </Rule>\n      </FeatureTypeStyle>\n    </UserStyle>\n  </NamedLayer>\n</StyledLayerDescriptor>\n' is not None
----------------------------------------------------------------------
Ran 30 tests in 942.635s

Any chance to fix the test case and make the PR pass? Otherwise I can take care of this.

@capooti
Copy link
Member Author

capooti commented Sep 9, 2019

@afabiani I can work on this tomorrow

@capooti
Copy link
Member Author

capooti commented Sep 10, 2019

@capooti your change makes sense, and currently you might have identified a wong test case too

======================================================================
FAIL: test_layer_upload (geonode.tests.integration.NormalUserTest)
Try uploading a layer and verify that the user can administrate
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/virtualenv/python2.7_with_system_site_packages/local/lib/python2.7/site-packages/timeout_decorator/timeout_decorator.py", line 81, in new_function
    return function(*args, **kwargs)
  File "/home/travis/build/GeoNode/geonode/geonode/tests/integration.py", line 223, in test_layer_upload
    self.assertIsNone(get_sld_for(gs_catalog, saved_layer))
AssertionError: u'\n<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"\n  xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n  xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">\n  <NamedLayer>\n    <Name>san_andres_y_providencia_poi_by_norman</Name>\n    <UserStyle>\n    <Name>san_andres_y_providencia_poi_by_norman</Name>\n    <Title>san_andres_y_providencia_poi_by_norman</Title>\n      <FeatureTypeStyle>\n        <Rule>\n\n<PointSymbolizer>\n  <Graphic>\n    <Mark>\n      <WellKnownName>x</WellKnownName>\n      <Fill>\n        <CssParameter name="fill">#880088</CssParameter>\n      </Fill>\n      <Stroke>\n        <CssParameter name="stroke">#ffbbff</CssParameter>\n      </Stroke>\n    </Mark>\n    <Size>10</Size>\n  </Graphic>\n</PointSymbolizer>\n\n        </Rule>\n      </FeatureTypeStyle>\n    </UserStyle>\n  </NamedLayer>\n</StyledLayerDescriptor>\n' is not None
----------------------------------------------------------------------
Ran 30 tests in 942.635s

Any chance to fix the test case and make the PR pass? Otherwise I can take care of this.

@afabiani could you explain me why that test is checking if gsconfig is returning a None style for the layer even after the test runs fixup_style on it?
The test should return Not None in my opinion, that is the reason why is failing I believe

@capooti capooti closed this Sep 10, 2019
@capooti
Copy link
Member Author

capooti commented Sep 10, 2019

opening a new one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed CLA Bot: community license agreement signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Line layer uploaded to GeoNode is rendered as point layer
2 participants