SlideShare uma empresa Scribd logo
1 de 1
Baixar para ler offline
Space Time Visualization Using Python 
I- 190 
State Hwy 31 
Delaware St 
Python Script: 
# arcpy 
import arcpy 
# environment and parameters for the tool 
arcpy.env.workspace = arcpy.GetParameterAsText(0) 
GPSinFeature = arcpy.GetParameterAsText(1) 
DateTimeS = arcpy.GetParameterAsText(2) 
OutOut4 = arcpy.GetParameterAsText(3) 
#set local variable 
FieldName1 = "hour" 
eldPrecision = 9 
FieldName2 = minute 
eldPrecision = 9 
FieldName3 = second 
eldPrecision = 9 
FieldName4 = TimeXAll 
FieldName5 = TimeXMin 
FieldName7 = TimeSec 
# add feild 3 times for three new elds (in gps 
shapele) 
arcpy.AddField_management(GPSinFeature, 
FieldName1, LONG, eldPrecision) 
arcpy.AddField_management(GPSinFeature, 
FieldName2, LONG, eldPrecision) 
arcpy.AddField_management(GPSinFeature, 
FieldName3, LONG, eldPrecision) 
# calculate time 
# creat a refrence eld which includes just 
time not date 
arcpy.AddField_management(GPSinFeature 
, FieldName4, TEXT, eldPrecision) 
# New: Convert any type of date eld to one 
standard date eld 
arcpy.ConvertTimeField_management 
(GPSinFeature,DateTimeS,yyyy-MM-dd 
HH:mm:ss;1033;;,HHMMSS,TEXT, 
yyyyMMddHHmmss) 
# New: copy the hh:mm:ss part of the 
Standard DateTimeS (just created) 
to the eld just created (TimeXAll) 
arcpy.CalculateField_management 
(GPSinFeature,TimeXAll,Mid( [HHMMSS], 
9, 14),VB,#) 
# add a eld to be able to copy the source 
for minute 
arcpy.AddField_management(GPSinFeature, 
FieldName5, TEXT, eldPrecision) 
# New: calculate the source eld for minute and 
sec 
arcpy.CalculateField_management(GPSin 
Feature,TimeXMin,Right( [TimeXAll], 4) 
,VB,#)#calculate hour 
arcpy.CalculateField_management 
(GPSinFeature,hour,Left( [TimeXAll], 2) 
,VB,#)#calculate min 
arcpy.CalculateField_management 
(GPSinFeature, 
minute,Left( [TimeXMin], 2),VB,#) 
#calculate sec 
arcpy.CalculateField_management 
(GPSinFeature,second,Right( [TimeXMin] 
, 2),VB,#) 
# create a eld for time based on seconds 
arcpy.AddField_management 
(GPSinFeature, FieldName7, LONG, 
eldPrecision) 
#add hour + minute+ sec and calculate 
the time based on sec 
arcpy.CalculateField_management 
(GPSinFeature,TimeSec,[hour] *3600 
+ [minute]*60 + [second],VB,#) 
# points to lines 
#parameters 
outFeature = Line_ready.shp 
outFeature2 = splited 
sortField = TimeSec 
radious = 2 Meter 
# create line based on sort led 
arcpy.PointsToLine_management 
(GPSinFeature, outFeature, , sortField) 
#spilit line based on point with .09 radious 
arcpy.SplitLineAtPoint_management 
(outFeature,GPSinFeature, outFeature2 
, radious) 
# extract two numbers based on time and 
make two elds 
#in order to do that we need to copy 
sample.shp and use it in spatial join script 
# Set local variables 
outFeatureClass = ForSpatial 
# Execute FeatureClassToFeatureClass 
arcpy.FeatureClassToFeatureClass_ 
conversion(GPSinFeature, arcpy.env. 
workspace, outFeatureClass) 
#parameters for spatial join 
OutPut3 = MinMaxSec 
inFeature8 = splited.shp 
# Replace a layer/table view name with a 
path to a dataset (which can be a layer le) 
or create the layer/table view within the script 
# The following inputs are layers or table views 
: splited, 5 
arcpy.SpatialJoin_analysis(inFeature8, 
GPSinFeature,OutPut3,JOIN_ONE_TO_ONE, 
KEEP_ALL,max max true false 
false 50 Double 0 0 ,Max,#,ForSpatial.shp, 
TimeSec,-1,-1;min min true false false 50 
Double 0 0 ,Min,#,ForSpatial.shp,TimeSec 
,-1,-1,INTERSECT,#,#) 
Sheridan Dr State Hwy 324 
Main St 
I- 90 
Shawnee Rd 
River Rd 
Saunders Settlement 
State Hwy 265 
State Hwy 266 
State Hwy 182 
Harlem Rd 
Erie Ave 
Townline Rd 
Main St 
State Hwy 198 
Main St 
Main St 
# feature to 3d 
arcpy.CheckOutExtension('3D') 
# parameters 
arcpy.FeatureTo3DByAttribute_3d 
(MinMaxSec.shp,OutOut4,min,max) 
PrimaryRoads 
Destinations 
GPS Track 
Water 
Erie County Block Groups 
Miles 
0.25 0.5 1 1.5 2

Mais conteúdo relacionado

Mais procurados

Network simulator 2
Network simulator 2Network simulator 2
Network simulator 2
AAKASH S
 
Climate data in r with the raster package
Climate data in r with the raster packageClimate data in r with the raster package
Climate data in r with the raster package
Alberto Labarga
 
lecture 5
lecture 5lecture 5
lecture 5
sajinsc
 

Mais procurados (20)

Pig TPC-H Benchmark and Performance Tuning
Pig TPC-H Benchmark and Performance TuningPig TPC-H Benchmark and Performance Tuning
Pig TPC-H Benchmark and Performance Tuning
 
Logistic Regression in R-An Exmple.
Logistic Regression in R-An Exmple. Logistic Regression in R-An Exmple.
Logistic Regression in R-An Exmple.
 
BeautifulSoup / selenium Deep dive
BeautifulSoup / selenium Deep diveBeautifulSoup / selenium Deep dive
BeautifulSoup / selenium Deep dive
 
Analyzing Larger RasterData in a Jupyter Notebook with GeoPySpark on AWS - FO...
Analyzing Larger RasterData in a Jupyter Notebook with GeoPySpark on AWS - FO...Analyzing Larger RasterData in a Jupyter Notebook with GeoPySpark on AWS - FO...
Analyzing Larger RasterData in a Jupyter Notebook with GeoPySpark on AWS - FO...
 
Network simulator 2
Network simulator 2Network simulator 2
Network simulator 2
 
Network simulator 2
Network simulator 2Network simulator 2
Network simulator 2
 
Three Functional Programming Technologies for Big Data
Three Functional Programming Technologies for Big DataThree Functional Programming Technologies for Big Data
Three Functional Programming Technologies for Big Data
 
Deep Learning on Aerial Imagery: What does it look like on a map?
Deep Learning on Aerial Imagery: What does it look like on a map?Deep Learning on Aerial Imagery: What does it look like on a map?
Deep Learning on Aerial Imagery: What does it look like on a map?
 
Climate data in r with the raster package
Climate data in r with the raster packageClimate data in r with the raster package
Climate data in r with the raster package
 
Machine Learning In Ruby
Machine Learning In RubyMachine Learning In Ruby
Machine Learning In Ruby
 
lecture 5
lecture 5lecture 5
lecture 5
 
Barbara Nelson [InfluxData] | How Can I Put That Dashboard in My App? | Influ...
Barbara Nelson [InfluxData] | How Can I Put That Dashboard in My App? | Influ...Barbara Nelson [InfluxData] | How Can I Put That Dashboard in My App? | Influ...
Barbara Nelson [InfluxData] | How Can I Put That Dashboard in My App? | Influ...
 
Terraform meetup 02_workspace_12_factorapp
Terraform meetup 02_workspace_12_factorappTerraform meetup 02_workspace_12_factorapp
Terraform meetup 02_workspace_12_factorapp
 
For beginner circle_ci_config_workflow_explanation
For beginner circle_ci_config_workflow_explanationFor beginner circle_ci_config_workflow_explanation
For beginner circle_ci_config_workflow_explanation
 
Script PyThon
Script PyThonScript PyThon
Script PyThon
 
10. Kapusta, Stofanak - eGlu
10. Kapusta, Stofanak - eGlu10. Kapusta, Stofanak - eGlu
10. Kapusta, Stofanak - eGlu
 
Advanced R Graphics
Advanced R GraphicsAdvanced R Graphics
Advanced R Graphics
 
scikit-cuda
scikit-cudascikit-cuda
scikit-cuda
 
Easily reduce runtimes with cython
Easily reduce runtimes with cythonEasily reduce runtimes with cython
Easily reduce runtimes with cython
 
Quick 入門 | iOS RDD テストフレームワーク for Swift/Objective-C
Quick 入門 | iOS RDD テストフレームワーク for Swift/Objective-CQuick 入門 | iOS RDD テストフレームワーク for Swift/Objective-C
Quick 入門 | iOS RDD テストフレームワーク for Swift/Objective-C
 

Semelhante a Illustrator_Sample

Python en la Plataforma ArcGIS
Python en la Plataforma ArcGISPython en la Plataforma ArcGIS
Python en la Plataforma ArcGIS
Xander Bakker
 
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみたスマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
Taro Matsuzawa
 
OSCON july 2011
OSCON july 2011OSCON july 2011
OSCON july 2011
chelm
 

Semelhante a Illustrator_Sample (20)

Profiling in Python
Profiling in PythonProfiling in Python
Profiling in Python
 
Python en la Plataforma ArcGIS
Python en la Plataforma ArcGISPython en la Plataforma ArcGIS
Python en la Plataforma ArcGIS
 
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみたスマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
 
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
 
Fullstack Conference - Proxies before proxies: The hidden gems of Javascript...
Fullstack Conference -  Proxies before proxies: The hidden gems of Javascript...Fullstack Conference -  Proxies before proxies: The hidden gems of Javascript...
Fullstack Conference - Proxies before proxies: The hidden gems of Javascript...
 
OSCON july 2011
OSCON july 2011OSCON july 2011
OSCON july 2011
 
V8
V8V8
V8
 
R and cpp
R and cppR and cpp
R and cpp
 
ECMAScript 6 Review
ECMAScript 6 ReviewECMAScript 6 Review
ECMAScript 6 Review
 
Object-Oriented JavaScript
Object-Oriented JavaScriptObject-Oriented JavaScript
Object-Oriented JavaScript
 
Object-Oriented Javascript
Object-Oriented JavascriptObject-Oriented Javascript
Object-Oriented Javascript
 
Ping to Pong
Ping to PongPing to Pong
Ping to Pong
 
Flux and InfluxDB 2.0 by Paul Dix
Flux and InfluxDB 2.0 by Paul DixFlux and InfluxDB 2.0 by Paul Dix
Flux and InfluxDB 2.0 by Paul Dix
 
Relational Database Access with Python ‘sans’ ORM
Relational Database Access with Python ‘sans’ ORM  Relational Database Access with Python ‘sans’ ORM
Relational Database Access with Python ‘sans’ ORM
 
OmpSs – improving the scalability of OpenMP
OmpSs – improving the scalability of OpenMPOmpSs – improving the scalability of OpenMP
OmpSs – improving the scalability of OpenMP
 
2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locator2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locator
 
2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locator2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locator
 
R and C++
R and C++R and C++
R and C++
 
How to practice functional programming in react
How to practice functional programming in reactHow to practice functional programming in react
How to practice functional programming in react
 
Emerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonEmerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the Horizon
 

Illustrator_Sample

  • 1. Space Time Visualization Using Python I- 190 State Hwy 31 Delaware St Python Script: # arcpy import arcpy # environment and parameters for the tool arcpy.env.workspace = arcpy.GetParameterAsText(0) GPSinFeature = arcpy.GetParameterAsText(1) DateTimeS = arcpy.GetParameterAsText(2) OutOut4 = arcpy.GetParameterAsText(3) #set local variable FieldName1 = "hour" eldPrecision = 9 FieldName2 = minute eldPrecision = 9 FieldName3 = second eldPrecision = 9 FieldName4 = TimeXAll FieldName5 = TimeXMin FieldName7 = TimeSec # add feild 3 times for three new elds (in gps shapele) arcpy.AddField_management(GPSinFeature, FieldName1, LONG, eldPrecision) arcpy.AddField_management(GPSinFeature, FieldName2, LONG, eldPrecision) arcpy.AddField_management(GPSinFeature, FieldName3, LONG, eldPrecision) # calculate time # creat a refrence eld which includes just time not date arcpy.AddField_management(GPSinFeature , FieldName4, TEXT, eldPrecision) # New: Convert any type of date eld to one standard date eld arcpy.ConvertTimeField_management (GPSinFeature,DateTimeS,yyyy-MM-dd HH:mm:ss;1033;;,HHMMSS,TEXT, yyyyMMddHHmmss) # New: copy the hh:mm:ss part of the Standard DateTimeS (just created) to the eld just created (TimeXAll) arcpy.CalculateField_management (GPSinFeature,TimeXAll,Mid( [HHMMSS], 9, 14),VB,#) # add a eld to be able to copy the source for minute arcpy.AddField_management(GPSinFeature, FieldName5, TEXT, eldPrecision) # New: calculate the source eld for minute and sec arcpy.CalculateField_management(GPSin Feature,TimeXMin,Right( [TimeXAll], 4) ,VB,#)#calculate hour arcpy.CalculateField_management (GPSinFeature,hour,Left( [TimeXAll], 2) ,VB,#)#calculate min arcpy.CalculateField_management (GPSinFeature, minute,Left( [TimeXMin], 2),VB,#) #calculate sec arcpy.CalculateField_management (GPSinFeature,second,Right( [TimeXMin] , 2),VB,#) # create a eld for time based on seconds arcpy.AddField_management (GPSinFeature, FieldName7, LONG, eldPrecision) #add hour + minute+ sec and calculate the time based on sec arcpy.CalculateField_management (GPSinFeature,TimeSec,[hour] *3600 + [minute]*60 + [second],VB,#) # points to lines #parameters outFeature = Line_ready.shp outFeature2 = splited sortField = TimeSec radious = 2 Meter # create line based on sort led arcpy.PointsToLine_management (GPSinFeature, outFeature, , sortField) #spilit line based on point with .09 radious arcpy.SplitLineAtPoint_management (outFeature,GPSinFeature, outFeature2 , radious) # extract two numbers based on time and make two elds #in order to do that we need to copy sample.shp and use it in spatial join script # Set local variables outFeatureClass = ForSpatial # Execute FeatureClassToFeatureClass arcpy.FeatureClassToFeatureClass_ conversion(GPSinFeature, arcpy.env. workspace, outFeatureClass) #parameters for spatial join OutPut3 = MinMaxSec inFeature8 = splited.shp # Replace a layer/table view name with a path to a dataset (which can be a layer le) or create the layer/table view within the script # The following inputs are layers or table views : splited, 5 arcpy.SpatialJoin_analysis(inFeature8, GPSinFeature,OutPut3,JOIN_ONE_TO_ONE, KEEP_ALL,max max true false false 50 Double 0 0 ,Max,#,ForSpatial.shp, TimeSec,-1,-1;min min true false false 50 Double 0 0 ,Min,#,ForSpatial.shp,TimeSec ,-1,-1,INTERSECT,#,#) Sheridan Dr State Hwy 324 Main St I- 90 Shawnee Rd River Rd Saunders Settlement State Hwy 265 State Hwy 266 State Hwy 182 Harlem Rd Erie Ave Townline Rd Main St State Hwy 198 Main St Main St # feature to 3d arcpy.CheckOutExtension('3D') # parameters arcpy.FeatureTo3DByAttribute_3d (MinMaxSec.shp,OutOut4,min,max) PrimaryRoads Destinations GPS Track Water Erie County Block Groups Miles 0.25 0.5 1 1.5 2