$wpdb post type and term query only works when there are no dashes or spaces in the term slug and title

In your code you are using "AND terms.name="shorelineorwaterway" where I don’t think shorelineorwaterway is your term name, it could be your terms slug. So you can modify this by "AND terms.slug = 'shorelineorwaterway' and here inside inverted commas you can use hyphen.

If you need to use term name then "AND terms.name="Your Term Name" would work.

And I’ve tested both above.

Hope I have cleared my thought.