OpenStreetMap logo OpenStreetMap

SherbetS's Diary

Recent diary entries

Preface

User Watmildon recently posted their conflation workflow with the new hospitals dataset in the HIFLD, and as such I thought I’d share my own process of converting these datasets into an OSM-readable format.

Workflow

With any good QGIS project, we start by adding the dataset we’re working with, (This particular dataset is accessible here on the HIFLD) and adding openstreetmap as a background layer.

Once that’s done, you map should look something like this:

Now that we’ve got our data loaded, we can go ahead and start converting it over to OSM schema. QGIS has a great set of tools for working with this data, and for this kind of work, Field Calculator and Attribute table are our friends.

The work we will be doing will require a lot of regex to work. I have no formal education in any kind of computer programming, but I do have a good friend that is very good at computer programming, that goes by the name of ChatGPT.

ChatGPT can happily crank out QGIS regex queries all day, as long as you have a grasp on what exactly you need to ask it to get what you want.

Here’s a query that I’ve gotten it to generate me:

“I have US database with a field in QGIS for phone numbers in the format (XXX) XXX-XXXX. I need to convert it to the format +1-XXX-XXX-XXXX using the regexp function”

regexp_replace("TELEPHONE", '^\\((\\d{3})\\) (\\d{3})-(\\d{4})$', '+1-\\1-\\2-\\3')

Do note that if you don’t explicitly tell ChatGPT the name of your field, it will make something up and you will need to fill your own field.

Now one of the most annoying parts of the HIFLD is that they bundle the street and house number into one field, generating something like ‘809 UNIVERSITY BOULEVARD EAST’. This is nothing ChatGPT can’t handle if we’re willing to get a little creative in what we ask it.

“Can you make a query that draws the first word of a sentence as long as it is a number in QGIS regex syntax?”

CASE 
  WHEN regexp_match(LEFT("sentence", strpos("sentence", ' ')-1), '^[0-9]+$') 
  THEN LEFT("sentence", strpos("sentence", ' ')-1) 
  ELSE NULL 
END

“Ok, now I need a qgis regex query that gets every word in a sentence besides the first word, unless the first word is not a number.”

CASE
    WHEN "ADDRESS" ~ '^[0-9]+\\s' THEN regexp_replace("ADDRESS", '^\\S+\\s(.*)$', '\\1')
    ELSE regexp_replace("ADDRESS", '^\\S+\\s+(.*)$', '\\1')
END

Make sure that you’re saving your generated fields in the field calculator correctly. QGIS defaults to 10 character integer, but in most cases it’s best to set it to text, and then set the length to 128 characters (OSM’s maximum)

It’s important to remember that if you’re working with a .shp file, the field name has a maximum of 10 characters, so for fields that are longer than 10 characters, such as addr:housenumber or addr:street, you will have to fill in the whole key when you load your data into JOSM. Other data structures such as geojson don’t have these limitations, but may have performance issues with very large amounts of data.

You won’t have to use ChatGPT for everything. QGIS has a function called ‘title’ that does what you might expect, formatting all the all capital names into first letter capitalization.

This is good for many of your fields, namely the street name, hospital name, etc.

We’ve gotten through the hard part, now to address the rest of the data. This means going back to the attribute table, and seeing what metadata has been provided to us.

To make things a little easier, we can delete the fields that we won’t be using for OSM

I won’t walk through how to interpret every single tag here, since I’ve already covered the processes for using regex and title function to get what you need from most of them.

For each field listed, you just generate the OSM key from your own research on the wiki.

For this dataset, this is the process that would be used for each field, and the OSM key it corresponds to.

Start by adding amenity=hospital to all objects.

NAME- title function, name=*

ADDRESS- regex covered above, addr:street=*

addr:housenumber=*

CITY- title function, addr:city=*

STATE- no function needed, addr:state=*

ZIP- no function needed, addr:postcode=*

TELEPHONE- regex covered above, phone=*

TYPE- This is the hard one, you will need to parse into the OSM healthcare scheme, [1][2]

STATUS- use this field to purge any data that isn’t operational, or is abandoned/closed.

POPULATION- you’ll have to filter out anything with null value (-999) then use capacity=*

WEBSITE- filter out the ‘NOT AVAILABLE’, website=*

STATE_ID- filter out the ‘NOT AVAILABLE’, ref=*

OWNER- no OSM key for this, but may be worth making one.

TRAUMA- currently represented on OSM by healthcare:specialty=trauma

HELIPAD- optionally, you can leave yourself a note to map the helipad of the hospital you’re working on.

It takes a good bit of time to do all this, but once it’s done you’ve got a nationwide dataset of good quality with much more metadata with most data already on OSM.

I’d like to note a few things that are rather inconvenient when working with this setup.

Firstly, this causes neck pain! When I’ve got my camera mounted and recording, the combination of the extra weight plus the aerodynamic profile make this camera very cumbersome on the neck. you will notice right away a mild pain in the back of your neck.

Secondly, dropping. I’m pretty clumsy, and after a good ride I come home and start taking everything off, primarily the camera off the helmet right away to alleviate the pain. I haven’t got a good place in my garage to set the camera down, so I hold it awkwardly while I try to open my bike crate, camera box, etc. and put things away. Twice now I’ve dropped the camera on the ground, and the first time it scratched the main lens pretty bad, and the new mark is visible on the newest photos I’ve taken.

Unfortunately, I haven’t had the tools for any superior camera mounts. My bike isn’t very conductive of temporary stick mounting, and all the selfie sticks I have are of a less than satisfactory length to use as a standalone system. I’ve thought about mounting it to a backpack like I used to do with my old LG360, but that suffers from lots of shake and insecure mounting. tying down all the straps on my backpack still made the stick wobble, and made it very inconvenient to work with.

I’ve also recently had an issue with the version of OsmAnd that I’m using, the latest version has a glitch that makes the currently recording track disappear if the start point isn’t on the screen. https://github.com/osmandapp/OsmAnd/issues/16947

All that aside, it still is rather easy to set up, and it’s not difficult to ride around for an hour or so and get some footage quickly.

Hi, my name is James Crawford, and I’m running for the OpenStreetMap US board.

About me

I’m a regular editor from Auburn, Alabama. I mainly contribute by editing TIGER road data, importing from external sources, POI surveying, street level imagery coverage, and backcountry trail details. I’ve been active on OSM for over 2 years, and I love keeping in touch with the US community about mapping efforts across the country, and I like seeing community leaders that are active in public forums, and are willing to mingle with their mapping peers.

My current priorities for OSM are as follows:

1: Encouraging the coordination of importing high quality data from external datasets. There are numerous datasets from government agencies in the United States with permissible licensing for use with OpenStreetMap. These datasets provide useful information about a variety of objects mapped in OpenStreetMap, and save huge amounts of time over having mappers collect the data redundantly. It is important to be in touch with the community when coordinating data imports, and it is important to be in touch with government agencies so that we can be more aware of available data that is free to use.

2: Prioritizing focus towards what OSM is useful for. OpenStreetMap defeats commercial competitors in the predictable niche- where there is a demand for geospatial data but no lucrative monetary return. Trails and public land data make a good example. Outdoor enthusiasts have a demand for accurate and low cost map data, but large scale commercial map providers have no commercial incentive to allocate resources towards maintaining this kind of data.

I’m a big fan of outreach, and I’m not a fan of the idea of serving on the board without having meaningful communication with the community. I manage a local community myself, and I love keeping in touch about mapping activities!

Thanks for the consideration,

-James

Hello everyone.

Recently, I’ve been trying to map National Recreation Trails in OSM. the NRT program will designate a ‘system’ as a national recreation trail, generally meaning all of the trails within a park or other public land.

I want to represent this on the map, but it seems to be beyond the scope of the type=route relations.

I’ve been considering using this: https://wiki.openstreetmap.org/wiki/Relation:network to try and represent these, but I ran into problems with this as well. I tried interpreting the documentation, but it was written so confusingly that I could not understand how to use this relation on the map at all. I asked on the talk page, but I’m still confused on the meaning of this relation.

Additionally, there are National Recreation Trails designated to places serving ATVs or ORVs. I don’t know if this is some redneck thing that the Europeans don’t have or what, but there was no documented tag for ATV or ORV paths on the wiki. so I also created the page https://wiki.openstreetmap.org/wiki/Tag:route%3Datv. I’ve been working on expanding this page as well.

Right now I’m using type=route for these system NRTs, but I feel that it’s probably incorrect and I’d love input from others.

Thanks, SherbetS

Location: Talladega County, Alabama, United States

Mapping with a game controller

Posted by SherbetS on 16 November 2021 in English.

Hello all,

I recently picked up mapping with the river modernization folks, and one of the first things I wanted to do was to speed up the rate at which I could modernize rivers.

When I was in 5th Grade, I bought a PlayStation 3 from a friend that I used to have sleepovers and play on together for 100 USD. it came with 2 controllers and I’ve since used them to play games, mostly on my computer.

Recently, I stumbled upon this program, that recognized my controller and let me map keybinds to it. I toyed around with it and ended up making a basic configuration to speed up my most common key combinations.

My initial control scheme

To complete any given riverbank with no other tags on the to-do list, I would simply press O, then move the right joystick up and to the left to add the desired tags natural=water and water=river, then to the right to mark the object complete.

If I ever messed up any part of the process, I could simply move the left joystick down and to the left to undo the change.

This control scheme was great, and much better than using the keyboard in terms of speed, but it still had its downsides.

In the area I was mapping, around 90% of the objects I was retagging were just rivers, but a few would be canal areas, which this control scheme would have trouble with. for canals, I would have to return to my keyboard to type in the necessary combination to add water=canal.

Making a new control scheme isn’t easy, since it can be difficult to rebuild your muscle memory after doing it a certain way for so long.

After pondering on it for a couple days, I devised this new control scheme:

The new control scheme, from above.

To achieve this new scheme, I had to mess around with the “Keyboard Shortcuts” settings of the JOSM editor. I changed the binds for: Delete Tags, Paste Tags, and added a bind for Canals, (I’ll elaborate later)

I changed these to a single key that JOSM didn’t use for anything else, since it would be simpler to add in the controller mapping software. Once they were all added, I simply bound them to the shoulders and triggers as in the picture above.

To achieve the canal option, I used the Custom Presets JOSM plugin to create a preset that assigned the fixed values natural=water water=canal to the object. when you add a preset to the toolbar, JOSM lets you create a keybind for it. I added it to the toolbar, created a keybind like I did for delete and paste tags, then mapped it to my controller. Unfortunately, you still have to press enter to confirm the canal preset, so I bound enter to the square button.

With this new setup, I am able to retag an object just by pressing the buttons in the numbered order in the picture.

I really enjoy this new setup, and it’s easier on the fingers. I am excited to see how I and others can adapt this style of mapping to other endeavors.