1

Topic: Locations

We've never really used the location functionality within R6. Instead relying on the Location Name field and query by polygon. However, we are starting to get a lot more queries for site based searches for monitoring and reporting and the current approach is just not consistent enough due to the amount of work in removing intersecting but not on site records and trying to track down records that have poorly matching location names. Having not really used locations i had a few queries;

1. Can records be assigned to a Location that is added after the record has been entered? (Batch update?)

2. Can Locations be maintained in R6 as boundaries as opposed to grid squares? I note there is a boundary option but this seems to behave as a source/link field rather than having any functionality.

Thanks in advance,

Ben

Natural History & Biodiversity Data Enthusiast

2

Re: Locations

BDeed wrote:

1. Can records be assigned to a Location that is added after the record has been entered? (Batch update?)

Yes - with large imports I will import locations to the location name field and use SQL to match to a location, based on a few simple "parameters" (e.g. ignore everything after a comma or dash, only match against villages, towns, cities, nature reserves &c. &c.). If it can't find a match, it just leaves the location information in the location name field. Much quicker than using the Recorder match to location step.

BDeed wrote:

2. Can Locations be maintained in R6 as boundaries as opposed to grid squares? I note there is a boundary option but this seems to behave as a source/link field rather than having any functionality.

Your assumption is AFAIK correct - and I find it's dangerous to rely on boundaries for anything permanent in case you have to reset the maps.

Charlie Barnes
Information Officer
Greater Lincolnshire Nature Partnership

3

Re: Locations

Hi Charlie, Any chance you could  share the SQL on how to achieve this?

Natural History & Biodiversity Data Enthusiast

4

Re: Locations

This is the SQL I use (without any of my custom name/location type matching). I use it to generate SQL statements rather than perform the batch update itself as I like to double check the output (and I usually do this on thousands of entries, so running it outside of Recorder means I can still use Recorder!).

select se.survey_event_key as "SEKey",se.Location_name as "CurrentLocationName", LN.item_name as "MatchedLocationName", dbo.LCReturnHectad (UPPER(Se.Spatial_Ref), Se.Spatial_Ref_System) as "Current1kmSquare", dbo.LCReturnHectad (UPPER(l.Spatial_Ref), l.Spatial_Ref_System) as "Matched1kmSquare", Ln.location_key as "MatchedLocationKey",

CASE WHEN (dbo.LCReturnHectad (UPPER(Se.Spatial_Ref), Se.Spatial_Ref_System) = dbo.LCReturnHectad (UPPER(l.Spatial_Ref), l.Spatial_Ref_System)) THEN
    'TRUE'
ELSE
    'FALSE'
END AS _10kmMatch,

'Update survey_event set location_key = ''' + Ln.location_key + ''' where survey_event_key = ''' + se.survey_event_key + ''';' as "SQL"
 
from survey_event se

LEFT JOIN Location_Name LN ON location_name  = LN.item_name AND LN.Preferred = 1
LEFT JOIN Location L ON LN.Location_Key = L.Location_Key

where survey_key = '%s'
            
and se.location_key is null

order by l.location_type_key

Then I run

select s.sample_key as "SKey", se.survey_event_key as "SEKey", se.location_key as "SELocationKey",

'Update sample set location_key = ''' + se.location_key + ''' where sample_key = ''' + s.sample_key + ''';' as "SQL"
 
from sample s

left join survey_event se on se.survey_Event_key = s.survey_event_key  

where survey_key = '%s'
and se.location_key is not null
and s.location_key is null

to update the samples to match the survey locations.

Charlie Barnes
Information Officer
Greater Lincolnshire Nature Partnership

5

Re: Locations

Sorry for not getting back to you before. I missed the notification.
Thank you for sharing!

Natural History & Biodiversity Data Enthusiast