Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Re: Error using shp2dta

From   Taavi Lai <>
Subject   Re: st: Re: Error using shp2dta
Date   Mon, 08 May 2006 13:31:04 +0300

Thank you for the suggestions, rewriting the code according these solved my problem.
Updated code included below

Taavi Lai

shell copy C:\ado\maps\prog\SHP2MIF.EXE SHP2MIF.EXE
fs *.shp
foreach f in `r(files)' {
local pos=strpos("`f'",".")
local f = substr("`f'",1,`pos'-1)
shell SHP2MIF.EXE `f'
capture: mif2dta `f', genid(ID) genc(coord)
shell erase SHP2MIF.EXE

Friedrich Huebler wrote:


Have you tried the combination of the DOS program SHP2MIF and the
Stata command -mif2dta-? Details at this page:

Stata can continue in spite of errors with the -capture- command.

Friedrich Huebler

--- Taavi Lai <> wrote:

Dear statalist,

After downloading a number of Europe shape files I tried to convert
all these to suite -tmap- using -shp2dta- but got an error message
(output below).
That raised two questions:

1) do you have suggestions how to improve the code (or were to look
for solution) so that the do file wouldn't abort in case of errors
2) I guess that shapefile causing the error is not of a type
suitable for -shp2dta- and therefore - is there a way to make these suitable
for -shp2dta-

Best regards,

. fs *.shp
bndnetarcs.shp hydronetpols.shp miscpolypols.shp translnkarcs.shp transnetpols.shp
bndnetpols.shp misclinkarcs.shp poppointpnts.shp translnknods.shp vegpolyarcs.shp
hydronetarcs.shp misclinkpnts.shp poppolyarcs.shp translnkpnts.shp vegpolypols.shp
hydronetnods.shp miscpolyarcs.shp poppolypols.shp transnetarcs.shp

. foreach f in `r(files)' {
2. local pos=strpos("`f'",".")
3. local f = substr("`f'",1,`pos'-1)
4. quiet: shp2dta using `f', database("`f'_database") coordinates("`f'_coordinates") replace
5. }
bndnetarcs.shp: polygon shapefile required

end of do-file

Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around *
* For searches and help try:
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index