Regular expression to extract road labels from OSM other_tags ref Planned maintenance...
Is there a service that would inform me whenever a new direct route is scheduled from a given airport?
How widely used is the term Treppenwitz? Is it something that most Germans know?
"Seemed to had" is it correct?
Letter Boxed validator
How can I make names more distinctive without making them longer?
Gastric acid as a weapon
I need to find the potential function of a vector field.
What LEGO pieces have "real-world" functionality?
I am not a queen, who am I?
Is 1 ppb equal to 1 μg/kg?
How much radiation do nuclear physics experiments expose researchers to nowadays?
Are my PIs rude or am I just being too sensitive?
ListPlot join points by nearest neighbor rather than order
Antler Helmet: Can it work?
If a contract sometimes uses the wrong name, is it still valid?
Is the address of a local variable a constexpr?
How to deal with a team lead who never gives me credit?
When to stop saving and start investing?
Bonus calculation: Am I making a mountain out of a molehill?
Stars Make Stars
What would be the ideal power source for a cybernetic eye?
Why was the term "discrete" used in discrete logarithm?
Can a non-EU citizen traveling with me come with me through the EU passport line?
List *all* the tuples!
Regular expression to extract road labels from OSM other_tags ref
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Regular expression substring for labellingHow to extract a single road from OSM GIS Database?OSM line labels in TilemillData Reviewer Regular Expression for HHMM time formatExtract large area from OSMRegular expression substring for labellingWhat regular expression engine does QGIS use?Extract addresses from osm fileUsing substring for labeling in QGIS?ArcGIS Data Reviewer Regular expression to limit the number of characters (Text Length) in a fieldExtract data from OSM url using QGIS
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
Extended question to the issue: Regular expression substring for labelling
The answers I've found on the link above were fine for "simple" road labels.
Unfortunately, I don't have a big SQL-knowledge, therefore, I would like to extend Erik's question.
How can we extract other road labels (alphanumeric) from the OSM lines layer "other_tags" between the ("ref"=>") and the last (")?
Examples:
- "ref"=>"AP 520" -> AP 520
- "ref"=>"M123-4" -> M123-4
- "ref"=>"EN 13-5" -> EN 13-5
- "ref"=>"AG-52" -> AG-52
In order to avoid to write thousands of different expressions depending on each example, isn't any expression that extracts the content only of "ref"=>"xxxxxxxx"?
I tried everything using the "regexp_substr".
qgis openstreetmap labeling regular-expression
add a comment |
Extended question to the issue: Regular expression substring for labelling
The answers I've found on the link above were fine for "simple" road labels.
Unfortunately, I don't have a big SQL-knowledge, therefore, I would like to extend Erik's question.
How can we extract other road labels (alphanumeric) from the OSM lines layer "other_tags" between the ("ref"=>") and the last (")?
Examples:
- "ref"=>"AP 520" -> AP 520
- "ref"=>"M123-4" -> M123-4
- "ref"=>"EN 13-5" -> EN 13-5
- "ref"=>"AG-52" -> AG-52
In order to avoid to write thousands of different expressions depending on each example, isn't any expression that extracts the content only of "ref"=>"xxxxxxxx"?
I tried everything using the "regexp_substr".
qgis openstreetmap labeling regular-expression
Can you post how the tag looks in the database. I would like to see how the quotation marks work in it. If you had a string String = ''' "ref"=>"AP 520" ''' and you wanted to only get 'AP 520' you would do , NewString = String.split(' " ')[-2] , that would give you 'AP 520' for the NewString.
– ed.hank
Dec 27 '17 at 20:50
add a comment |
Extended question to the issue: Regular expression substring for labelling
The answers I've found on the link above were fine for "simple" road labels.
Unfortunately, I don't have a big SQL-knowledge, therefore, I would like to extend Erik's question.
How can we extract other road labels (alphanumeric) from the OSM lines layer "other_tags" between the ("ref"=>") and the last (")?
Examples:
- "ref"=>"AP 520" -> AP 520
- "ref"=>"M123-4" -> M123-4
- "ref"=>"EN 13-5" -> EN 13-5
- "ref"=>"AG-52" -> AG-52
In order to avoid to write thousands of different expressions depending on each example, isn't any expression that extracts the content only of "ref"=>"xxxxxxxx"?
I tried everything using the "regexp_substr".
qgis openstreetmap labeling regular-expression
Extended question to the issue: Regular expression substring for labelling
The answers I've found on the link above were fine for "simple" road labels.
Unfortunately, I don't have a big SQL-knowledge, therefore, I would like to extend Erik's question.
How can we extract other road labels (alphanumeric) from the OSM lines layer "other_tags" between the ("ref"=>") and the last (")?
Examples:
- "ref"=>"AP 520" -> AP 520
- "ref"=>"M123-4" -> M123-4
- "ref"=>"EN 13-5" -> EN 13-5
- "ref"=>"AG-52" -> AG-52
In order to avoid to write thousands of different expressions depending on each example, isn't any expression that extracts the content only of "ref"=>"xxxxxxxx"?
I tried everything using the "regexp_substr".
qgis openstreetmap labeling regular-expression
qgis openstreetmap labeling regular-expression
edited Jan 7 '18 at 10:50
underdark♦
69.2k13178349
69.2k13178349
asked Dec 27 '17 at 19:18
Filipe TabordaFilipe Taborda
112
112
Can you post how the tag looks in the database. I would like to see how the quotation marks work in it. If you had a string String = ''' "ref"=>"AP 520" ''' and you wanted to only get 'AP 520' you would do , NewString = String.split(' " ')[-2] , that would give you 'AP 520' for the NewString.
– ed.hank
Dec 27 '17 at 20:50
add a comment |
Can you post how the tag looks in the database. I would like to see how the quotation marks work in it. If you had a string String = ''' "ref"=>"AP 520" ''' and you wanted to only get 'AP 520' you would do , NewString = String.split(' " ')[-2] , that would give you 'AP 520' for the NewString.
– ed.hank
Dec 27 '17 at 20:50
Can you post how the tag looks in the database. I would like to see how the quotation marks work in it. If you had a string String = ''' "ref"=>"AP 520" ''' and you wanted to only get 'AP 520' you would do , NewString = String.split(' " ')[-2] , that would give you 'AP 520' for the NewString.
– ed.hank
Dec 27 '17 at 20:50
Can you post how the tag looks in the database. I would like to see how the quotation marks work in it. If you had a string String = ''' "ref"=>"AP 520" ''' and you wanted to only get 'AP 520' you would do , NewString = String.split(' " ')[-2] , that would give you 'AP 520' for the NewString.
– ed.hank
Dec 27 '17 at 20:50
add a comment |
3 Answers
3
active
oldest
votes
Try the following:
regexp_substr("other_tags",'"ref"=>"([\w- ]+)')
Should work assuming you have no other kinds of whitespaces, or unusual symbols/letters in the ref field.
It looks for "ref"=>
then matches any word characters (A-Z, a-z, 0-9, underscore) as well as dash and space ([A-Za-z0-9-_ ]
) and continues doing so (+
) until it stops matching (in this case when it hits the double quotation mark).
add a comment |
You can open your OSM file with the QuickOSM plugin. It will split your "other_tags" into fields automatically.
If the process is too slow, you can provide a custom OSM Conf file to get the field you want in QuickOSM, "Open OSM file" tab.
add a comment |
This one worked for me:
regexp_substr( "other_tags", '\"ref"=>"(.*?)\"')
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "79"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f266423%2fregular-expression-to-extract-road-labels-from-osm-other-tags-ref%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try the following:
regexp_substr("other_tags",'"ref"=>"([\w- ]+)')
Should work assuming you have no other kinds of whitespaces, or unusual symbols/letters in the ref field.
It looks for "ref"=>
then matches any word characters (A-Z, a-z, 0-9, underscore) as well as dash and space ([A-Za-z0-9-_ ]
) and continues doing so (+
) until it stops matching (in this case when it hits the double quotation mark).
add a comment |
Try the following:
regexp_substr("other_tags",'"ref"=>"([\w- ]+)')
Should work assuming you have no other kinds of whitespaces, or unusual symbols/letters in the ref field.
It looks for "ref"=>
then matches any word characters (A-Z, a-z, 0-9, underscore) as well as dash and space ([A-Za-z0-9-_ ]
) and continues doing so (+
) until it stops matching (in this case when it hits the double quotation mark).
add a comment |
Try the following:
regexp_substr("other_tags",'"ref"=>"([\w- ]+)')
Should work assuming you have no other kinds of whitespaces, or unusual symbols/letters in the ref field.
It looks for "ref"=>
then matches any word characters (A-Z, a-z, 0-9, underscore) as well as dash and space ([A-Za-z0-9-_ ]
) and continues doing so (+
) until it stops matching (in this case when it hits the double quotation mark).
Try the following:
regexp_substr("other_tags",'"ref"=>"([\w- ]+)')
Should work assuming you have no other kinds of whitespaces, or unusual symbols/letters in the ref field.
It looks for "ref"=>
then matches any word characters (A-Z, a-z, 0-9, underscore) as well as dash and space ([A-Za-z0-9-_ ]
) and continues doing so (+
) until it stops matching (in this case when it hits the double quotation mark).
edited Dec 30 '17 at 10:01
answered Dec 30 '17 at 9:30
she_weedsshe_weeds
1,464316
1,464316
add a comment |
add a comment |
You can open your OSM file with the QuickOSM plugin. It will split your "other_tags" into fields automatically.
If the process is too slow, you can provide a custom OSM Conf file to get the field you want in QuickOSM, "Open OSM file" tab.
add a comment |
You can open your OSM file with the QuickOSM plugin. It will split your "other_tags" into fields automatically.
If the process is too slow, you can provide a custom OSM Conf file to get the field you want in QuickOSM, "Open OSM file" tab.
add a comment |
You can open your OSM file with the QuickOSM plugin. It will split your "other_tags" into fields automatically.
If the process is too slow, you can provide a custom OSM Conf file to get the field you want in QuickOSM, "Open OSM file" tab.
You can open your OSM file with the QuickOSM plugin. It will split your "other_tags" into fields automatically.
If the process is too slow, you can provide a custom OSM Conf file to get the field you want in QuickOSM, "Open OSM file" tab.
answered Apr 4 '18 at 6:37
etrimailleetrimaille
1,943620
1,943620
add a comment |
add a comment |
This one worked for me:
regexp_substr( "other_tags", '\"ref"=>"(.*?)\"')
New contributor
add a comment |
This one worked for me:
regexp_substr( "other_tags", '\"ref"=>"(.*?)\"')
New contributor
add a comment |
This one worked for me:
regexp_substr( "other_tags", '\"ref"=>"(.*?)\"')
New contributor
This one worked for me:
regexp_substr( "other_tags", '\"ref"=>"(.*?)\"')
New contributor
New contributor
answered 3 mins ago
Pierre HARDYPierre HARDY
1
1
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f266423%2fregular-expression-to-extract-road-labels-from-osm-other-tags-ref%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you post how the tag looks in the database. I would like to see how the quotation marks work in it. If you had a string String = ''' "ref"=>"AP 520" ''' and you wanted to only get 'AP 520' you would do , NewString = String.split(' " ')[-2] , that would give you 'AP 520' for the NewString.
– ed.hank
Dec 27 '17 at 20:50