Jump to content

 
Photo

selecting by attributes

- - - - -

  • Please log in to reply
12 replies to this topic

#1
Cartogirl

Cartogirl

    Contributor

  • Validated Member
  • PipPip
  • 19 posts
  • Gender:Female
  • Canada

I have two files that I want only to pull certain data from. I need to find the slope % that is equal to 0.5 degrees and greater in an area that is <=-49 and >=-65. When I use the following equation I end up with everything being selected. I know this is incorrect as I can clearly see that the area covered by the slope points is less than that of the Bathy Depth.

I have tried many different ways and still am not comming up with the correct statement. If I relate the tables will that work? If so how do I then select only the data that I need?
Any suggestions would be great.

Cheers

Robyn

"Depth" <= -49 OR "Depth" >= -65 AND "slope" >= .5

#2
Robert2009

Robert2009

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 122 posts
  • Gender:Male
  • Location:Las Cruces, NM
  • United States

I have two files that I want only to pull certain data from. I need to find the slope % that is equal to 0.5 degrees and greater in an area that is <=-49 and >=-65. When I use the following equation I end up with everything being selected. I know this is incorrect as I can clearly see that the area covered by the slope points is less than that of the Bathy Depth.

I have tried many different ways and still am not comming up with the correct statement. If I relate the tables will that work? If so how do I then select only the data that I need?
Any suggestions would be great.

Cheers

Robyn

"Depth" <= -49 OR "Depth" >= -65 AND "slope" >= .5


Have you tried this way Depth" <= -49 OR "Depth" >= -65 OR "slope" >= .5 ? Change from AND to OR after 65 ?

Adios from Southern New Mexico

#3
François Goulet

François Goulet

    Ultimate Contributor

  • Validated Member
  • PipPipPipPipPipPip
  • 689 posts
  • Gender:Male
  • Location:Mille-Isles, Qc
  • Interests:Cartography, History, Graphic Design and almost everything else...
  • Canada

I'm not an SQL expert, but I'd try to query them "separately".

"AND" has a precedence over the OR so you should applied you "AND" criteria over each Depth. It should be something like:

("Depth" <= -49 AND "slope" >= .5) OR ("Depth" >= -65 AND "slope" >= .5)

#4
Cartogirl

Cartogirl

    Contributor

  • Validated Member
  • PipPip
  • 19 posts
  • Gender:Female
  • Canada

Thanks for the suggestions. The selection is still incorrect as all slope data was selected. I wonder if it is the files I am using that is causing the issues, would it be better to go back to the original joined bathy and slope files?
How do relates work? I know that they are good for this kind of situation where more than one field is needed ,so if I related them how would I then select from the two tables?

Thanks again

Cheers

Robyn

#5
François Goulet

François Goulet

    Ultimate Contributor

  • Validated Member
  • PipPipPipPipPipPip
  • 689 posts
  • Gender:Male
  • Location:Mille-Isles, Qc
  • Interests:Cartography, History, Graphic Design and almost everything else...
  • Canada

You could always make your selection in each file and then intersecting the results...

#6
Hans van der Maarel

Hans van der Maarel

    CartoTalk Editor-in-Chief

  • Admin
  • PipPipPipPipPipPipPip
  • 3,901 posts
  • Gender:Male
  • Location:The Netherlands
  • Interests:Cartography, GIS, history, popular science, music.
  • Netherlands

Assuming you mean "Depth between -49 and -65 and slope greater than .5":

("Depth" <= -49 AND "Depth" >= -65) AND "slope" >= .5

Hans van der Maarel - Cartotalk Editor
Red Geographics
Email: hans@redgeographics.com / Twitter: @redgeographics

#7
Cartogirl

Cartogirl

    Contributor

  • Validated Member
  • PipPip
  • 19 posts
  • Gender:Female
  • Canada

I used the intersect tool and it seems to have selected the data needed. This was after trying each of the above statements. I am still not certain why none of them worked as they would generate all the data as selected, which again makes me think I did something incorrect when creating the new shape files that were then being looked at.

I now need to clip the point file with the classification area file and seem to only be generating a point file back.


Thanks for all the help.

Cheers

#8
frax

frax

    Hall of Fame

  • Associate Admin
  • PipPipPipPipPipPipPip
  • 2,320 posts
  • Gender:Male
  • Location:Stockholm, Sweden
  • Interests:music, hiking, friends, nature, photography, traveling. and maps!
  • Sweden

Is this ArcGIS? Aren't you supposed to write the fields like [depth] and not quoted? The query builder in ArcGIS is quite ok, and usually works for me if I am not sure.
Hugo Ahlenius
Nordpil - custom maps and GIS
http://nordpil.com/
Twitter

#9
josie

josie

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 120 posts
  • Gender:Female
  • Location:Netherlands
  • Netherlands

Assuming 'depth' and 'slope' are fields:

Try

'depth' <=-49
AND 'depth >=-65
AND 'slope' = 0.5

#10
josie

josie

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 120 posts
  • Gender:Female
  • Location:Netherlands
  • Netherlands

Just noticed Hans already suggested that actually. He is correct, it should work!

#11
frax

frax

    Hall of Fame

  • Associate Admin
  • PipPipPipPipPipPipPip
  • 2,320 posts
  • Gender:Male
  • Location:Stockholm, Sweden
  • Interests:music, hiking, friends, nature, photography, traveling. and maps!
  • Sweden

Also - if it is ArcGIS - then I think you can do it in a (visual) multi-step process - do one select, and reselect out of that selection.
Hugo Ahlenius
Nordpil - custom maps and GIS
http://nordpil.com/
Twitter

#12
dsl

dsl

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 225 posts
  • Gender:Male
  • Location:Denver
  • United States

Is this ArcGIS? Aren't you supposed to write the fields like [depth] and not quoted? The query builder in ArcGIS is quite ok, and usually works for me if I am not sure.


Brackets are for geodatabases and quotes are for shapefiles if memory serves.

Cheers,
David

#13
Cartogirl

Cartogirl

    Contributor

  • Validated Member
  • PipPip
  • 19 posts
  • Gender:Female
  • Canada

Thanks to all the help and advice on solving this problem.
Things are moving along now and it was because of all your ideas and suggestions.

Cheers

Robyn




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

-->