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

Update spatial_relationships_exercises.rst #111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

grolls23
Copy link

I've updated the answer key to use Multilinestring instead of Linestring in the query identifying which streets Atlantic Commons joins with, and updated the answer key to include S. Oxford Street.

The existing answer key says moving from Multilinestring to Linestring saves keystrokes and that both methods describe the same shape but this isn't true, which is evident because the Linestring representation of Atlantic Commons doesn't join with South Oxford Street. Although the note above says we can no longer use ST_Touches(), ST_DWithin also provides incorrect results with the 0.1m buffer.

I think keeping the Multilinestring Representation is preferable, at least for this question.

Update Answer Key to
a) Use Multilinestring instead of Linestring in query
b) Show intersection with S. Oxford Street as reflected by street view image
@@ -83,14 +83,15 @@ Exercises
FROM nyc_streets
WHERE ST_DWithin(
geom,
ST_GeomFromText('LINESTRING(586782 4504202,586864 4504216)', 26918),
ST_GeomFromText('MULTILINESTRING((586781.701577724 4504202.15314339,586863.51964484 4504215.9881701))', 26918),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefered stripping off the extra precision, for ease of eyeballing.

@dr-jts
Copy link
Contributor

dr-jts commented Jan 24, 2024

I agree with this change. A likely usage scenario is that the user would just cut-n-paste the geometry from the first query into the second. So the format & precision of the geometry don't really matter - the key aspect is that it is the identical geometry returned from the query.

If this change is made then the following note should be changed as well.

@robe2
Copy link
Member

robe2 commented Oct 3, 2024

I agree with this change. A likely usage scenario is that the user would just cut-n-paste the geometry from the first query into the second. So the format & precision of the geometry don't really matter - the key aspect is that it is the identical geometry returned from the query.

If this change is made then the following note should be changed as well.

What if we apply a max_degitis arg ST_AsText to the prior example, so that shortens it a bit. https://postgis.net/docs/ST_AsText.html That would serve the purpose of getting rid of all those extra decimals nobody needs and shorten the output.

e.g.

SELECT ST_AsText(geom, 0)
  FROM nyc_streets
  WHERE name = 'Atlantic Commons';

will result in:

MULTILINESTRING((586782 4504202,586864 4504216))

Granted we'd still have the annoying MULTILINESTRING thing, but it's a bit less annoying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants