Parse path for any workspace Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm...
The Nth Gryphon Number
Noise in Eigenvalues plot
Table formatting with tabularx?
Was the pager message from Nick Fury to Captain Marvel unnecessary?
Twin's vs. Twins'
As a dual citizen, my US passport will expire one day after traveling to the US. Will this work?
Can I cut the hair of a conjured korred with a blade made of precious material to harvest that material from the korred?
Does the main washing effect of soap come from foam?
How to resize main filesystem
Should man-made satellites feature an intelligent inverted "cow catcher"?
IC on Digikey is 5x more expensive than board containing same IC on Alibaba: How?
New Order #6: Easter Egg
How can I list files in reverse time order by a command and pass them as arguments to another command?
Is the Mordenkainen's Sword spell underpowered?
How do Java 8 default methods hеlp with lambdas?
My mentor says to set image to Fine instead of RAW — how is this different from JPG?
Why can't fire hurt Daenerys but it did to Jon Snow in season 1?
Where and when has Thucydides been studied?
Keep at all times, the minus sign above aligned with minus sign below
How to ask rejected full-time candidates to apply to teach individual courses?
By what mechanism was the 2017 UK General Election called?
The test team as an enemy of development? And how can this be avoided?
Improvising over quartal voicings
How to name indistinguishable henchmen in a screenplay?
Parse path for any workspace
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Python - formatting path strings and checking if a path existsHow to use model-builder iterator with a custom bit of arbitrary code?scratch workspace in-line variable, up one level?Using just the variable name (not full file path) for inline variable substitution in Model BuilderModelbuilder: How to use submodel output as input for another tool?Implementing output file extension considering type of workspace in ModelBuilder?Setting one input parameter for several models?Parse path multiple files and iterate multivalue or raster in ModelBuilder?Iterating rasters using parse path in complex model in ModelBuilder?Iterate Dataset and Workspace to Add Rasters to Mosaic Dataset?Connecting output feature class to newly created geodatabase in ModelBuilder?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I have a model which adds and calculates a new field with a workspace path.
I upload only one layer from database to the model (called "tline"). Parse path can detect only the name and file of this layer, not the whole path to the GDB file which contains this layer. The path can be found only if I add a workspace variable and set the path to database in this variable. So when I set a parameter "Parse type" like "Path" for "tline" layer, model won't work, it just add a new field and says that "The process did not execute because the precondition is false."
How can I find the path to GDB automatically using model builder? It is also important when I have several GDB files that have the same layer "tline" within. I just want to overcome a manual input of GDB file into the model.
arcgis-desktop modelbuilder parameters file-path
|
show 6 more comments
I have a model which adds and calculates a new field with a workspace path.
I upload only one layer from database to the model (called "tline"). Parse path can detect only the name and file of this layer, not the whole path to the GDB file which contains this layer. The path can be found only if I add a workspace variable and set the path to database in this variable. So when I set a parameter "Parse type" like "Path" for "tline" layer, model won't work, it just add a new field and says that "The process did not execute because the precondition is false."
How can I find the path to GDB automatically using model builder? It is also important when I have several GDB files that have the same layer "tline" within. I just want to overcome a manual input of GDB file into the model.
arcgis-desktop modelbuilder parameters file-path
What is the relationship between the model and the tool dialog that you have pictured? They do not appear to correspond to each other.
– PolyGeo♦
Aug 16 '16 at 0:45
If you have python knowledge you can insert a script to find the path using os.path
– jbalk
Aug 16 '16 at 4:26
@PolyGeo It has no relationshps, I just want to show that often you need to put a workspace variable and make the path to GDB file manually. I think with some Arcmap tools this process can be simplified.
– Pavel Pereverzev
Aug 16 '16 at 5:26
@jbalk Unfortunately I have no any knowledge of Py. Moreover, I make this model for several computers with other users, and if I am not mistaken Python script file should be on their computer too to import it properly to the model. I think it'sa bit complicated thing.
– Pavel Pereverzev
Aug 16 '16 at 5:28
2
I'm trying to understand what it is that you are asking. I think when you saythe view (called "tline")
you are meaning a layer called "tline", and wanting to be able to access the source of that layer (presumably a file geodatabase feature class) and then to parse the path of that to get its file geodatabase.
– PolyGeo♦
Aug 16 '16 at 7:12
|
show 6 more comments
I have a model which adds and calculates a new field with a workspace path.
I upload only one layer from database to the model (called "tline"). Parse path can detect only the name and file of this layer, not the whole path to the GDB file which contains this layer. The path can be found only if I add a workspace variable and set the path to database in this variable. So when I set a parameter "Parse type" like "Path" for "tline" layer, model won't work, it just add a new field and says that "The process did not execute because the precondition is false."
How can I find the path to GDB automatically using model builder? It is also important when I have several GDB files that have the same layer "tline" within. I just want to overcome a manual input of GDB file into the model.
arcgis-desktop modelbuilder parameters file-path
I have a model which adds and calculates a new field with a workspace path.
I upload only one layer from database to the model (called "tline"). Parse path can detect only the name and file of this layer, not the whole path to the GDB file which contains this layer. The path can be found only if I add a workspace variable and set the path to database in this variable. So when I set a parameter "Parse type" like "Path" for "tline" layer, model won't work, it just add a new field and says that "The process did not execute because the precondition is false."
How can I find the path to GDB automatically using model builder? It is also important when I have several GDB files that have the same layer "tline" within. I just want to overcome a manual input of GDB file into the model.
arcgis-desktop modelbuilder parameters file-path
arcgis-desktop modelbuilder parameters file-path
edited Dec 19 '17 at 11:19
Kazuhito
16.5k41885
16.5k41885
asked Aug 15 '16 at 21:31
Pavel PereverzevPavel Pereverzev
543211
543211
What is the relationship between the model and the tool dialog that you have pictured? They do not appear to correspond to each other.
– PolyGeo♦
Aug 16 '16 at 0:45
If you have python knowledge you can insert a script to find the path using os.path
– jbalk
Aug 16 '16 at 4:26
@PolyGeo It has no relationshps, I just want to show that often you need to put a workspace variable and make the path to GDB file manually. I think with some Arcmap tools this process can be simplified.
– Pavel Pereverzev
Aug 16 '16 at 5:26
@jbalk Unfortunately I have no any knowledge of Py. Moreover, I make this model for several computers with other users, and if I am not mistaken Python script file should be on their computer too to import it properly to the model. I think it'sa bit complicated thing.
– Pavel Pereverzev
Aug 16 '16 at 5:28
2
I'm trying to understand what it is that you are asking. I think when you saythe view (called "tline")
you are meaning a layer called "tline", and wanting to be able to access the source of that layer (presumably a file geodatabase feature class) and then to parse the path of that to get its file geodatabase.
– PolyGeo♦
Aug 16 '16 at 7:12
|
show 6 more comments
What is the relationship between the model and the tool dialog that you have pictured? They do not appear to correspond to each other.
– PolyGeo♦
Aug 16 '16 at 0:45
If you have python knowledge you can insert a script to find the path using os.path
– jbalk
Aug 16 '16 at 4:26
@PolyGeo It has no relationshps, I just want to show that often you need to put a workspace variable and make the path to GDB file manually. I think with some Arcmap tools this process can be simplified.
– Pavel Pereverzev
Aug 16 '16 at 5:26
@jbalk Unfortunately I have no any knowledge of Py. Moreover, I make this model for several computers with other users, and if I am not mistaken Python script file should be on their computer too to import it properly to the model. I think it'sa bit complicated thing.
– Pavel Pereverzev
Aug 16 '16 at 5:28
2
I'm trying to understand what it is that you are asking. I think when you saythe view (called "tline")
you are meaning a layer called "tline", and wanting to be able to access the source of that layer (presumably a file geodatabase feature class) and then to parse the path of that to get its file geodatabase.
– PolyGeo♦
Aug 16 '16 at 7:12
What is the relationship between the model and the tool dialog that you have pictured? They do not appear to correspond to each other.
– PolyGeo♦
Aug 16 '16 at 0:45
What is the relationship between the model and the tool dialog that you have pictured? They do not appear to correspond to each other.
– PolyGeo♦
Aug 16 '16 at 0:45
If you have python knowledge you can insert a script to find the path using os.path
– jbalk
Aug 16 '16 at 4:26
If you have python knowledge you can insert a script to find the path using os.path
– jbalk
Aug 16 '16 at 4:26
@PolyGeo It has no relationshps, I just want to show that often you need to put a workspace variable and make the path to GDB file manually. I think with some Arcmap tools this process can be simplified.
– Pavel Pereverzev
Aug 16 '16 at 5:26
@PolyGeo It has no relationshps, I just want to show that often you need to put a workspace variable and make the path to GDB file manually. I think with some Arcmap tools this process can be simplified.
– Pavel Pereverzev
Aug 16 '16 at 5:26
@jbalk Unfortunately I have no any knowledge of Py. Moreover, I make this model for several computers with other users, and if I am not mistaken Python script file should be on their computer too to import it properly to the model. I think it'sa bit complicated thing.
– Pavel Pereverzev
Aug 16 '16 at 5:28
@jbalk Unfortunately I have no any knowledge of Py. Moreover, I make this model for several computers with other users, and if I am not mistaken Python script file should be on their computer too to import it properly to the model. I think it'sa bit complicated thing.
– Pavel Pereverzev
Aug 16 '16 at 5:28
2
2
I'm trying to understand what it is that you are asking. I think when you say
the view (called "tline")
you are meaning a layer called "tline", and wanting to be able to access the source of that layer (presumably a file geodatabase feature class) and then to parse the path of that to get its file geodatabase.– PolyGeo♦
Aug 16 '16 at 7:12
I'm trying to understand what it is that you are asking. I think when you say
the view (called "tline")
you are meaning a layer called "tline", and wanting to be able to access the source of that layer (presumably a file geodatabase feature class) and then to parse the path of that to get its file geodatabase.– PolyGeo♦
Aug 16 '16 at 7:12
|
show 6 more comments
3 Answers
3
active
oldest
votes
After seeing your conservation with @GISGE, though reluctantly, I have decided to put in my two cents. I do not think there is a direct way of getting file path of a layer's data source from given Model Builder tools. However you can use Calculate Value tool to get the required parts. Assuming you are always going to use LAYERs from your MXD's TOC, the setup below should work.
The difference here, Parse Path is not connected to your input layer and output_value is a precondition to Add Field to make sure Calculate Value will run before anything. The trick is to input the code very below into this tool as shown below.
And here is the code:
Expression
GetPath("%tline%")
Code Block
def GetPath(lyr):
import os
mxd=arcpy.mapping.MapDocument("CURRENT")
target=arcpy.mapping.ListLayers(mxd,lyr)[0]
return target.dataSource
ASSUMPTIONS
- this works only with LAYERs from your CURRENT (the map document which is already open and where your model is open in editing mode) MXD's TOC
- if there are more than two layers with the same name, this will get
the first instance in the order of display - it will only work with layers which support dataSource property (essentially the feature and raster layers are just safe)
@faih_dur, heeey everything works fine!!! Thnak you so much. However, when I add Calculate field tool, it makes one mistake: instead ofD:ДокументыАСПИРОФОРМЛЕНИЕtest.gdb
it makesD:ДокументыАСПИРОФОРМЛЕНИЕest.gdb
I typed '%Value%' and used Python 9.3
– Pavel Pereverzev
Aug 16 '16 at 20:42
Try r"%Value%". Also have a look at gis.stackexchange.com/questions/63816/….
– fatih_dur
Aug 17 '16 at 3:31
add a comment |
First make sure you drag-and-drop the input feature class into your model from the Catalog Window or ArcCatalog, and not as a layer from ArcMap's TOC. Otherwise the path property (and extension) can't be retrieved.
Then use the expression '%Value%'
with the PYTHON
parser in the Calculate Field:
Make sure your new field is long enough to hold the dataset's path (the default 50 characters might not be enough).
I don't thinktline
in the asker's case is a dataset like in your answer. I think it is a layer.
– PolyGeo♦
Aug 16 '16 at 8:25
yes, it is a layer, containing in Gdb file.
– Pavel Pereverzev
Aug 16 '16 at 8:31
A layer (in your display or in memory) is a view, or a representation of a feature class (i.e. a dataset saved on your disc - in a gdb or in a folder). So do you want to access the layer in ArcMap's TOC, or the feature class? How are users supposed to use your model?
– GISGe
Aug 16 '16 at 8:34
@GISGe In this case I need to get an access to feature class, from path of which I need only the path to *.gdb file, not the whole path to feature class. Other users are going to test my model which find roads that are torn by other ones of lower levels (in case someone made a mistake during attribute edition). The model I made is working without mistakes but I think that it would be better not to click hundred times to set a path to base, because there are lots of levels to check. I thought about drag'n'drop function to dialog box of model but it appeared to be impossible in modelbuilder
– Pavel Pereverzev
Aug 16 '16 at 8:49
If you choose thePATH
option in theParse Path
tool, you will get the path to the gdb (e.g. C:datamygdb.gdb). The rest of your comment is not clear to me, sorry.
– GISGe
Aug 16 '16 at 8:56
|
show 3 more comments
And reading this comment "First make sure you drag-and-drop the input feature class into your model from the Catalog Window or ArcCatalog, and not as a layer from ArcMap's TOC. Otherwise the path property (and extension) can't be retrieved." made my day and solved a problem puzling me for the last two days - why a new tool I created to add Path field and populate would not populate the path values. A Modelbuilder 'gotcha' that I have not seen explained anywhere else. Many thanks!
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%2f207076%2fparse-path-for-any-workspace%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
After seeing your conservation with @GISGE, though reluctantly, I have decided to put in my two cents. I do not think there is a direct way of getting file path of a layer's data source from given Model Builder tools. However you can use Calculate Value tool to get the required parts. Assuming you are always going to use LAYERs from your MXD's TOC, the setup below should work.
The difference here, Parse Path is not connected to your input layer and output_value is a precondition to Add Field to make sure Calculate Value will run before anything. The trick is to input the code very below into this tool as shown below.
And here is the code:
Expression
GetPath("%tline%")
Code Block
def GetPath(lyr):
import os
mxd=arcpy.mapping.MapDocument("CURRENT")
target=arcpy.mapping.ListLayers(mxd,lyr)[0]
return target.dataSource
ASSUMPTIONS
- this works only with LAYERs from your CURRENT (the map document which is already open and where your model is open in editing mode) MXD's TOC
- if there are more than two layers with the same name, this will get
the first instance in the order of display - it will only work with layers which support dataSource property (essentially the feature and raster layers are just safe)
@faih_dur, heeey everything works fine!!! Thnak you so much. However, when I add Calculate field tool, it makes one mistake: instead ofD:ДокументыАСПИРОФОРМЛЕНИЕtest.gdb
it makesD:ДокументыАСПИРОФОРМЛЕНИЕest.gdb
I typed '%Value%' and used Python 9.3
– Pavel Pereverzev
Aug 16 '16 at 20:42
Try r"%Value%". Also have a look at gis.stackexchange.com/questions/63816/….
– fatih_dur
Aug 17 '16 at 3:31
add a comment |
After seeing your conservation with @GISGE, though reluctantly, I have decided to put in my two cents. I do not think there is a direct way of getting file path of a layer's data source from given Model Builder tools. However you can use Calculate Value tool to get the required parts. Assuming you are always going to use LAYERs from your MXD's TOC, the setup below should work.
The difference here, Parse Path is not connected to your input layer and output_value is a precondition to Add Field to make sure Calculate Value will run before anything. The trick is to input the code very below into this tool as shown below.
And here is the code:
Expression
GetPath("%tline%")
Code Block
def GetPath(lyr):
import os
mxd=arcpy.mapping.MapDocument("CURRENT")
target=arcpy.mapping.ListLayers(mxd,lyr)[0]
return target.dataSource
ASSUMPTIONS
- this works only with LAYERs from your CURRENT (the map document which is already open and where your model is open in editing mode) MXD's TOC
- if there are more than two layers with the same name, this will get
the first instance in the order of display - it will only work with layers which support dataSource property (essentially the feature and raster layers are just safe)
@faih_dur, heeey everything works fine!!! Thnak you so much. However, when I add Calculate field tool, it makes one mistake: instead ofD:ДокументыАСПИРОФОРМЛЕНИЕtest.gdb
it makesD:ДокументыАСПИРОФОРМЛЕНИЕest.gdb
I typed '%Value%' and used Python 9.3
– Pavel Pereverzev
Aug 16 '16 at 20:42
Try r"%Value%". Also have a look at gis.stackexchange.com/questions/63816/….
– fatih_dur
Aug 17 '16 at 3:31
add a comment |
After seeing your conservation with @GISGE, though reluctantly, I have decided to put in my two cents. I do not think there is a direct way of getting file path of a layer's data source from given Model Builder tools. However you can use Calculate Value tool to get the required parts. Assuming you are always going to use LAYERs from your MXD's TOC, the setup below should work.
The difference here, Parse Path is not connected to your input layer and output_value is a precondition to Add Field to make sure Calculate Value will run before anything. The trick is to input the code very below into this tool as shown below.
And here is the code:
Expression
GetPath("%tline%")
Code Block
def GetPath(lyr):
import os
mxd=arcpy.mapping.MapDocument("CURRENT")
target=arcpy.mapping.ListLayers(mxd,lyr)[0]
return target.dataSource
ASSUMPTIONS
- this works only with LAYERs from your CURRENT (the map document which is already open and where your model is open in editing mode) MXD's TOC
- if there are more than two layers with the same name, this will get
the first instance in the order of display - it will only work with layers which support dataSource property (essentially the feature and raster layers are just safe)
After seeing your conservation with @GISGE, though reluctantly, I have decided to put in my two cents. I do not think there is a direct way of getting file path of a layer's data source from given Model Builder tools. However you can use Calculate Value tool to get the required parts. Assuming you are always going to use LAYERs from your MXD's TOC, the setup below should work.
The difference here, Parse Path is not connected to your input layer and output_value is a precondition to Add Field to make sure Calculate Value will run before anything. The trick is to input the code very below into this tool as shown below.
And here is the code:
Expression
GetPath("%tline%")
Code Block
def GetPath(lyr):
import os
mxd=arcpy.mapping.MapDocument("CURRENT")
target=arcpy.mapping.ListLayers(mxd,lyr)[0]
return target.dataSource
ASSUMPTIONS
- this works only with LAYERs from your CURRENT (the map document which is already open and where your model is open in editing mode) MXD's TOC
- if there are more than two layers with the same name, this will get
the first instance in the order of display - it will only work with layers which support dataSource property (essentially the feature and raster layers are just safe)
answered Aug 16 '16 at 13:41
fatih_durfatih_dur
3,63821028
3,63821028
@faih_dur, heeey everything works fine!!! Thnak you so much. However, when I add Calculate field tool, it makes one mistake: instead ofD:ДокументыАСПИРОФОРМЛЕНИЕtest.gdb
it makesD:ДокументыАСПИРОФОРМЛЕНИЕest.gdb
I typed '%Value%' and used Python 9.3
– Pavel Pereverzev
Aug 16 '16 at 20:42
Try r"%Value%". Also have a look at gis.stackexchange.com/questions/63816/….
– fatih_dur
Aug 17 '16 at 3:31
add a comment |
@faih_dur, heeey everything works fine!!! Thnak you so much. However, when I add Calculate field tool, it makes one mistake: instead ofD:ДокументыАСПИРОФОРМЛЕНИЕtest.gdb
it makesD:ДокументыАСПИРОФОРМЛЕНИЕest.gdb
I typed '%Value%' and used Python 9.3
– Pavel Pereverzev
Aug 16 '16 at 20:42
Try r"%Value%". Also have a look at gis.stackexchange.com/questions/63816/….
– fatih_dur
Aug 17 '16 at 3:31
@faih_dur, heeey everything works fine!!! Thnak you so much. However, when I add Calculate field tool, it makes one mistake: instead of
D:ДокументыАСПИРОФОРМЛЕНИЕtest.gdb
it makes D:ДокументыАСПИРОФОРМЛЕНИЕest.gdb
I typed '%Value%' and used Python 9.3– Pavel Pereverzev
Aug 16 '16 at 20:42
@faih_dur, heeey everything works fine!!! Thnak you so much. However, when I add Calculate field tool, it makes one mistake: instead of
D:ДокументыАСПИРОФОРМЛЕНИЕtest.gdb
it makes D:ДокументыАСПИРОФОРМЛЕНИЕest.gdb
I typed '%Value%' and used Python 9.3– Pavel Pereverzev
Aug 16 '16 at 20:42
Try r"%Value%". Also have a look at gis.stackexchange.com/questions/63816/….
– fatih_dur
Aug 17 '16 at 3:31
Try r"%Value%". Also have a look at gis.stackexchange.com/questions/63816/….
– fatih_dur
Aug 17 '16 at 3:31
add a comment |
First make sure you drag-and-drop the input feature class into your model from the Catalog Window or ArcCatalog, and not as a layer from ArcMap's TOC. Otherwise the path property (and extension) can't be retrieved.
Then use the expression '%Value%'
with the PYTHON
parser in the Calculate Field:
Make sure your new field is long enough to hold the dataset's path (the default 50 characters might not be enough).
I don't thinktline
in the asker's case is a dataset like in your answer. I think it is a layer.
– PolyGeo♦
Aug 16 '16 at 8:25
yes, it is a layer, containing in Gdb file.
– Pavel Pereverzev
Aug 16 '16 at 8:31
A layer (in your display or in memory) is a view, or a representation of a feature class (i.e. a dataset saved on your disc - in a gdb or in a folder). So do you want to access the layer in ArcMap's TOC, or the feature class? How are users supposed to use your model?
– GISGe
Aug 16 '16 at 8:34
@GISGe In this case I need to get an access to feature class, from path of which I need only the path to *.gdb file, not the whole path to feature class. Other users are going to test my model which find roads that are torn by other ones of lower levels (in case someone made a mistake during attribute edition). The model I made is working without mistakes but I think that it would be better not to click hundred times to set a path to base, because there are lots of levels to check. I thought about drag'n'drop function to dialog box of model but it appeared to be impossible in modelbuilder
– Pavel Pereverzev
Aug 16 '16 at 8:49
If you choose thePATH
option in theParse Path
tool, you will get the path to the gdb (e.g. C:datamygdb.gdb). The rest of your comment is not clear to me, sorry.
– GISGe
Aug 16 '16 at 8:56
|
show 3 more comments
First make sure you drag-and-drop the input feature class into your model from the Catalog Window or ArcCatalog, and not as a layer from ArcMap's TOC. Otherwise the path property (and extension) can't be retrieved.
Then use the expression '%Value%'
with the PYTHON
parser in the Calculate Field:
Make sure your new field is long enough to hold the dataset's path (the default 50 characters might not be enough).
I don't thinktline
in the asker's case is a dataset like in your answer. I think it is a layer.
– PolyGeo♦
Aug 16 '16 at 8:25
yes, it is a layer, containing in Gdb file.
– Pavel Pereverzev
Aug 16 '16 at 8:31
A layer (in your display or in memory) is a view, or a representation of a feature class (i.e. a dataset saved on your disc - in a gdb or in a folder). So do you want to access the layer in ArcMap's TOC, or the feature class? How are users supposed to use your model?
– GISGe
Aug 16 '16 at 8:34
@GISGe In this case I need to get an access to feature class, from path of which I need only the path to *.gdb file, not the whole path to feature class. Other users are going to test my model which find roads that are torn by other ones of lower levels (in case someone made a mistake during attribute edition). The model I made is working without mistakes but I think that it would be better not to click hundred times to set a path to base, because there are lots of levels to check. I thought about drag'n'drop function to dialog box of model but it appeared to be impossible in modelbuilder
– Pavel Pereverzev
Aug 16 '16 at 8:49
If you choose thePATH
option in theParse Path
tool, you will get the path to the gdb (e.g. C:datamygdb.gdb). The rest of your comment is not clear to me, sorry.
– GISGe
Aug 16 '16 at 8:56
|
show 3 more comments
First make sure you drag-and-drop the input feature class into your model from the Catalog Window or ArcCatalog, and not as a layer from ArcMap's TOC. Otherwise the path property (and extension) can't be retrieved.
Then use the expression '%Value%'
with the PYTHON
parser in the Calculate Field:
Make sure your new field is long enough to hold the dataset's path (the default 50 characters might not be enough).
First make sure you drag-and-drop the input feature class into your model from the Catalog Window or ArcCatalog, and not as a layer from ArcMap's TOC. Otherwise the path property (and extension) can't be retrieved.
Then use the expression '%Value%'
with the PYTHON
parser in the Calculate Field:
Make sure your new field is long enough to hold the dataset's path (the default 50 characters might not be enough).
answered Aug 16 '16 at 7:58
GISGeGISGe
9,2221339
9,2221339
I don't thinktline
in the asker's case is a dataset like in your answer. I think it is a layer.
– PolyGeo♦
Aug 16 '16 at 8:25
yes, it is a layer, containing in Gdb file.
– Pavel Pereverzev
Aug 16 '16 at 8:31
A layer (in your display or in memory) is a view, or a representation of a feature class (i.e. a dataset saved on your disc - in a gdb or in a folder). So do you want to access the layer in ArcMap's TOC, or the feature class? How are users supposed to use your model?
– GISGe
Aug 16 '16 at 8:34
@GISGe In this case I need to get an access to feature class, from path of which I need only the path to *.gdb file, not the whole path to feature class. Other users are going to test my model which find roads that are torn by other ones of lower levels (in case someone made a mistake during attribute edition). The model I made is working without mistakes but I think that it would be better not to click hundred times to set a path to base, because there are lots of levels to check. I thought about drag'n'drop function to dialog box of model but it appeared to be impossible in modelbuilder
– Pavel Pereverzev
Aug 16 '16 at 8:49
If you choose thePATH
option in theParse Path
tool, you will get the path to the gdb (e.g. C:datamygdb.gdb). The rest of your comment is not clear to me, sorry.
– GISGe
Aug 16 '16 at 8:56
|
show 3 more comments
I don't thinktline
in the asker's case is a dataset like in your answer. I think it is a layer.
– PolyGeo♦
Aug 16 '16 at 8:25
yes, it is a layer, containing in Gdb file.
– Pavel Pereverzev
Aug 16 '16 at 8:31
A layer (in your display or in memory) is a view, or a representation of a feature class (i.e. a dataset saved on your disc - in a gdb or in a folder). So do you want to access the layer in ArcMap's TOC, or the feature class? How are users supposed to use your model?
– GISGe
Aug 16 '16 at 8:34
@GISGe In this case I need to get an access to feature class, from path of which I need only the path to *.gdb file, not the whole path to feature class. Other users are going to test my model which find roads that are torn by other ones of lower levels (in case someone made a mistake during attribute edition). The model I made is working without mistakes but I think that it would be better not to click hundred times to set a path to base, because there are lots of levels to check. I thought about drag'n'drop function to dialog box of model but it appeared to be impossible in modelbuilder
– Pavel Pereverzev
Aug 16 '16 at 8:49
If you choose thePATH
option in theParse Path
tool, you will get the path to the gdb (e.g. C:datamygdb.gdb). The rest of your comment is not clear to me, sorry.
– GISGe
Aug 16 '16 at 8:56
I don't think
tline
in the asker's case is a dataset like in your answer. I think it is a layer.– PolyGeo♦
Aug 16 '16 at 8:25
I don't think
tline
in the asker's case is a dataset like in your answer. I think it is a layer.– PolyGeo♦
Aug 16 '16 at 8:25
yes, it is a layer, containing in Gdb file.
– Pavel Pereverzev
Aug 16 '16 at 8:31
yes, it is a layer, containing in Gdb file.
– Pavel Pereverzev
Aug 16 '16 at 8:31
A layer (in your display or in memory) is a view, or a representation of a feature class (i.e. a dataset saved on your disc - in a gdb or in a folder). So do you want to access the layer in ArcMap's TOC, or the feature class? How are users supposed to use your model?
– GISGe
Aug 16 '16 at 8:34
A layer (in your display or in memory) is a view, or a representation of a feature class (i.e. a dataset saved on your disc - in a gdb or in a folder). So do you want to access the layer in ArcMap's TOC, or the feature class? How are users supposed to use your model?
– GISGe
Aug 16 '16 at 8:34
@GISGe In this case I need to get an access to feature class, from path of which I need only the path to *.gdb file, not the whole path to feature class. Other users are going to test my model which find roads that are torn by other ones of lower levels (in case someone made a mistake during attribute edition). The model I made is working without mistakes but I think that it would be better not to click hundred times to set a path to base, because there are lots of levels to check. I thought about drag'n'drop function to dialog box of model but it appeared to be impossible in modelbuilder
– Pavel Pereverzev
Aug 16 '16 at 8:49
@GISGe In this case I need to get an access to feature class, from path of which I need only the path to *.gdb file, not the whole path to feature class. Other users are going to test my model which find roads that are torn by other ones of lower levels (in case someone made a mistake during attribute edition). The model I made is working without mistakes but I think that it would be better not to click hundred times to set a path to base, because there are lots of levels to check. I thought about drag'n'drop function to dialog box of model but it appeared to be impossible in modelbuilder
– Pavel Pereverzev
Aug 16 '16 at 8:49
If you choose the
PATH
option in the Parse Path
tool, you will get the path to the gdb (e.g. C:datamygdb.gdb). The rest of your comment is not clear to me, sorry.– GISGe
Aug 16 '16 at 8:56
If you choose the
PATH
option in the Parse Path
tool, you will get the path to the gdb (e.g. C:datamygdb.gdb). The rest of your comment is not clear to me, sorry.– GISGe
Aug 16 '16 at 8:56
|
show 3 more comments
And reading this comment "First make sure you drag-and-drop the input feature class into your model from the Catalog Window or ArcCatalog, and not as a layer from ArcMap's TOC. Otherwise the path property (and extension) can't be retrieved." made my day and solved a problem puzling me for the last two days - why a new tool I created to add Path field and populate would not populate the path values. A Modelbuilder 'gotcha' that I have not seen explained anywhere else. Many thanks!
add a comment |
And reading this comment "First make sure you drag-and-drop the input feature class into your model from the Catalog Window or ArcCatalog, and not as a layer from ArcMap's TOC. Otherwise the path property (and extension) can't be retrieved." made my day and solved a problem puzling me for the last two days - why a new tool I created to add Path field and populate would not populate the path values. A Modelbuilder 'gotcha' that I have not seen explained anywhere else. Many thanks!
add a comment |
And reading this comment "First make sure you drag-and-drop the input feature class into your model from the Catalog Window or ArcCatalog, and not as a layer from ArcMap's TOC. Otherwise the path property (and extension) can't be retrieved." made my day and solved a problem puzling me for the last two days - why a new tool I created to add Path field and populate would not populate the path values. A Modelbuilder 'gotcha' that I have not seen explained anywhere else. Many thanks!
And reading this comment "First make sure you drag-and-drop the input feature class into your model from the Catalog Window or ArcCatalog, and not as a layer from ArcMap's TOC. Otherwise the path property (and extension) can't be retrieved." made my day and solved a problem puzling me for the last two days - why a new tool I created to add Path field and populate would not populate the path values. A Modelbuilder 'gotcha' that I have not seen explained anywhere else. Many thanks!
answered 7 mins ago
OzMarkOzMark
412
412
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%2f207076%2fparse-path-for-any-workspace%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
What is the relationship between the model and the tool dialog that you have pictured? They do not appear to correspond to each other.
– PolyGeo♦
Aug 16 '16 at 0:45
If you have python knowledge you can insert a script to find the path using os.path
– jbalk
Aug 16 '16 at 4:26
@PolyGeo It has no relationshps, I just want to show that often you need to put a workspace variable and make the path to GDB file manually. I think with some Arcmap tools this process can be simplified.
– Pavel Pereverzev
Aug 16 '16 at 5:26
@jbalk Unfortunately I have no any knowledge of Py. Moreover, I make this model for several computers with other users, and if I am not mistaken Python script file should be on their computer too to import it properly to the model. I think it'sa bit complicated thing.
– Pavel Pereverzev
Aug 16 '16 at 5:28
2
I'm trying to understand what it is that you are asking. I think when you say
the view (called "tline")
you are meaning a layer called "tline", and wanting to be able to access the source of that layer (presumably a file geodatabase feature class) and then to parse the path of that to get its file geodatabase.– PolyGeo♦
Aug 16 '16 at 7:12