wbuchanan / StataJSON

JSON IO operations for Stata using the Jackson Java Library
http://wbuchanan.github.io/StataJSON
21 stars 6 forks source link

error message for "ggeocode" #22

Open yichenx opened 7 years ago

yichenx commented 7 years ago

I'm trying to geocode some addresses. DO.txt

But the code stops working and gives the following error.

java.lang.NoSuchMethodError: org.paces.Stata.MetaData.Meta.getStataobs()Lorg/paces/Stata/Observations/Observations; at org.paces.Stata.Google.DataRetrieval.<init>(DataRetrieval.java:39) at org.paces.Stata.Google.Google.geocode(Google.java:26) I doublechecked with the sample code and stata returns same error.

do2.txt

Thanks!

wbuchanan commented 7 years ago

@yichenx I think this is related to a dependency update that I made. I'll try to see if I can patch this over the weekend. I'd expect everyone will need to update this a bit more as I modify one of the underlying dependent libraries (StataJavaUtilities), but my longer term plan is to have that library get installed separately to avoid any classpath issues like what happened in one of the other recent tickets.

In the mean time, you could use jsonio rv to make the requests to the API and return a single record with the associated metadata included in the variable labels.

yichenx commented 7 years ago

Thank you!

wbuchanan commented 7 years ago

@yichenx

I got bogged down with work this weekend, but haven't forgot about looking into this. I don't think it will be a difficult fix and just wanted to keep you in the loop.

wbuchanan commented 7 years ago

@yichenx

I tried last night using the examples in the help file and didn't get the error. Can you see if you can reproduce the error if you use those examples? Type help ggeocode to see the examples I'm referencing. There are some fields that may not always populate, but I was able to get the latitude and longitude values for each of the examples as well as the other values using the optional arguments.

wbuchanan commented 7 years ago

Also if you have brewscheme installed on your machine, you'll want to update that :

ado, find(brewscheme)
ado uninstall [#]
net install brewscheme, from(http://wbuchanan.github.io/brewscheme)

There is a dependency issue with the older versions of brewscheme. I'm going to end up decoupling some of that stuff in the not too distant future, but this would be a way to solve the problem if it is a dependency issue.

yichenx commented 7 years ago

I followed your instruction but somehow I ran into the same error message. Here's the error message when I ran the example codes:

java.lang.NoSuchMethodError: org.paces.Stata.MetaData.Meta.getStataobs()Lorg/paces/Stata/Observations/Observations; at org.paces.Stata.Google.DataRetrieval.(DataRetrieval.java:39) at org.paces.Stata.Google.Google.geocode(Google.java:26)

When I tried to update brewscheme, I got two package number. Is that normal? ado, find(brewscheme)

[22] package brewscheme from http://wbuchanan.github.io/brewscheme 'BREWSCHEME': a toolkit for data visualizations in Stata. [23] package brewscheme from http://wbuchanan.github.io/brewscheme 'BREWSCHEME': a toolkit for data visualizations in Stata.

Thanks a lot for your help.

wbuchanan commented 7 years ago

So you should:

ado uninstall [23]
ado uninstall [22]
net inst brewscheme, from(http://wbuchanan.github.io/brewscheme)

This is likely an issue with the Java classpath and one of the plugins used in older versions of brewscheme relying on a slightly earlier version of StataJavaUtilities.

yichenx commented 7 years ago

Yes. I did run the above code. The error message was after I install the new brewscheme:

java.lang.NoSuchMethodError: org.paces.Stata.MetaData.Meta.getStataobs()Lorg/paces/Stata/Observations/Observations; at org.paces.Stata.Google.DataRetrieval.(DataRetrieval.java:39) at org.paces.Stata.Google.Google.geocode(Google.java:26)

wbuchanan commented 7 years ago

@yichenx Ok thanks for the info. I'll try to look into this during the week at some point. Shouldn't be too difficult of a change to find/make.

yichenx commented 7 years ago

@wbuchanan Thanks a lot!

wbuchanan commented 7 years ago

@yichenx Can you copy/paste the code from the file above into one of the comments? I keep losing track of the file and having to download it again and am trying to keep my file system from getting too cluttered.

yichenx commented 7 years ago

Sure. @wbuchanan

local maxid1 = 468 local maxid2 = 1176 forvalues x=1/2{ clear all display x' forvalues i=1/maxidx'' { use temp\geocodex'.dta, clear keep if id==i' ggeocode address, ret(viewport address bbox) save temp\geocodex'_`i'.dta, replace } }

wbuchanan commented 6 years ago

@yichenx The example code you have above is not valid Stata code. That said, you'll want to obtain an API key from Google to use ggeocode.