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 <[email protected]>
To   [email protected]
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:

Taavi,

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

http://huebler.info/2005/20051106_tmap.html

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

Friedrich Huebler

--- Taavi Lai <[email protected]> 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,
Taavi

. 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
r(610);

end of do-file
r(610);

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com *
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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