|
|||
|
Dear members !
I have a problem reading Arcview (ESRI) SHP files. I found an OCX control which was properly incorporated in my VO programme. A tree structure of classes are ShapeFile-->ShapeFields----->ShapeField. I have troubles with access method (getting Fieldname class ; ShapeFields(ThisData) ). I found an example written in VB6 in technical specifications for that OCX control as follows //--------------------------------- VisualBasic6 code Sub ReadShape() Dim ThisRecord As Long, ThisData As Long, ThisPart As Long, VertCount As Long With ShapeIn ..ReadDataOnMove ..OpenShape "C:\Temp\Polygon.shp", shpOpen For ThisRecord = 1 To .RecordCount For ThisData = 1 To .ShapeFields.Count ' a line bellow is what I would like to print or get from a SHP file Debug.Print .ShapeFields(ThisData).FieldName, ..ShapeFields(ThisData).Value Next ThisData .MoveNext Next ThisRecord End With End Sub // ----------------End VB Code I wrote a VO code : METHOD ReadShape() CLASS TopAppWindow LOCAL ThisRecord,ThisData,ThisPart as LONG LOCAL oSHP as ShapeFiles local oShFields as ShapeFields LOCAL oParts as Parts LOCAL oFld as ShapeField LOCAL uValue as USUAL oSHP := ShapeFiles{} // CLASS CREATOR oSHP:ReadDataOnMove := FullRead oSHP:OpenShape("G:\Program Files\ESRI\AEJEE\DATA\USA\lakes.shp",shpOpen ) oParts := oSHP:Parts oShFields := oSHP:ShapeFields FOR ThisRecord := 1 to oSHP:RecordCount FOR ThisData := 1 to (oSHP:ShapeFields):Count // a line bellow doesn't work, because I can't get adequate ShapeField oFld := oSHP:ShapeFields:ThisData // a syntax oShp:ShapeFields:ThisData --> ThisData would be an access name which of // cours doesn't exists in OCX control // a syntax oShp:ShapeFields.ThisData --> ThisData would be a structure ; VO doesn't permitt // a syntax oShp:ShapeFields (ThisData) --> SYNTAX NOT ALLOWED uValue := oFld:FieldName next ThisData NEXT ThisRecord RETURN self Thanks in advance Andrej Terkaj |
|
|
||||
|
||||
|
|
|
|||
|
Try
oFld := oSHP:[ShapeFields,ThisData] -- Carlos Rocha --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 111010-2, 10-10-2011 Tested on: 11-10-2011 13:04:00 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com |
|
|||
|
Andrej,
Have you tried something like the code below. You might have to type oRecord and oFld as object until you are sure what you are getting. Regards, Willie FOR ThisRecord := 1 to oSHP:RecordCount oRecord := oSHP[ThisRecord] FOR ThisData := 1 to (oRecord:ShapeFields):Count oFld := oRecord:ShareFields[ThisData]:value NEXT NEXT |
|
|||
|
Thank you, Carlos !
Doesn't work. Error msg: An unhandled exception occured in module MSVBM60.DLL in your application Entity ShapeFiles:ShapeFields:Access line 12 ACCESS ShapeFields( ) CLASS ShapeFiles LOCAL oMethod AS cOleMethod LOCAL uRetValue AS USUAL oMethod := cOleMethod{} oMethod:symName := String2Symbol("ShapeFields") oMethod:iMemberid := 1745027091 oMethod:wInvokeKind := INVOKE_PROPERTYGET oMethod:bRetType := VT_DISPATCH // line bellow is line No.12 uRetValue := SELF:__Invoke(oMethod, DWORD(_BP+16),PCount()) uRetValue := ShapeFields{uRetValue} RETURN (uRetValue) Best regards Andrej Terkaj "Carlos Rocha" <carlos.rochaDELETETHIS@doossier.com> wrote in message news:4e943110$0$2678$a729d347@news.telepac.pt... > Try > > oFld := oSHP:[ShapeFields,ThisData] > > > -- > Carlos Rocha > > > --- > avast! Antivirus: Outbound message clean. > Virus Database (VPS): 111010-2, 10-10-2011 > Tested on: 11-10-2011 13:04:00 > avast! - copyright (c) 1988-2011 AVAST Software. > http://www.avast.com > > > > |
|
|||
|
Thank you Willie !
Doesn't work ! I made definitions as you proposed oSHP AS OBJECT oRecord := oSHP[ThisRecord] // VO Error operator used on non-array (I agree) Best regards Andrej Terkaj "Willie Moore" <williem@wmconsulting.com> wrote in message news:j71cl4$5p9$1@speranza.aioe.org... > Andrej, > > Have you tried something like the code below. You might have to type > oRecord and oFld as object until you are sure what you are getting. > > Regards, > Willie > > FOR ThisRecord := 1 to oSHP:RecordCount > oRecord := oSHP[ThisRecord] > FOR ThisData := 1 to (oRecord:ShapeFields):Count > oFld := oRecord:ShareFields[ThisData]:value > NEXT > NEXT > > |
|
|||
|
Andrej,
Have you used the debugger to try to look into the OCX? If you really get stuck you can always write some vb code to interface the OCX into your code. Working with OCXs is much easier in Vulcan.net or VB.net. Regards, Willie "andrej Terkaj" wrote in message news:j71vte$5ja$1@news.siol.net... Thank you Willie ! Doesn't work ! I made definitions as you proposed oSHP AS OBJECT oRecord := oSHP[ThisRecord] // VO Error operator used on non-array (I agree) Best regards Andrej Terkaj "Willie Moore" <williem@wmconsulting.com> wrote in message news:j71cl4$5p9$1@speranza.aioe.org... > Andrej, > > Have you tried something like the code below. You might have to type > oRecord and oFld as object until you are sure what you are getting. > > Regards, > Willie > > FOR ThisRecord := 1 to oSHP:RecordCount > oRecord := oSHP[ThisRecord] > FOR ThisData := 1 to (oRecord:ShapeFields):Count > oFld := oRecord:ShareFields[ThisData]:value > NEXT > NEXT > > |
|
|||
|
Willie !
I believe you, but ... My knowledge of VO stops when we are talking about imported activeX code (look at my answer to Carlos) At this moment I am also still far away from Vulcan (.NET) environment. I plan to start with Vulcan to develop some extended appl. for hand held computers, but business always catched me in old VO projects. Best regards and thank you again for your answers. Andrej "Willie Moore" <williem@wmconsulting.com> wrote in message news:j720qp$t5k$1@speranza.aioe.org... > Andrej, > > Have you used the debugger to try to look into the OCX? If you really get > stuck you can always write some vb code to interface the OCX into your > code. Working with OCXs is much easier in Vulcan.net or VB.net. > > Regards, > Willie > > "andrej Terkaj" wrote in message news:j71vte$5ja$1@news.siol.net... > > Thank you Willie ! > > Doesn't work ! I made definitions as you proposed oSHP AS OBJECT > > oRecord := oSHP[ThisRecord] // VO Error operator used on non-array (I > agree) > > Best regards > > Andrej Terkaj > > > > > "Willie Moore" <williem@wmconsulting.com> wrote in message > news:j71cl4$5p9$1@speranza.aioe.org... >> Andrej, >> >> Have you tried something like the code below. You might have to type >> oRecord and oFld as object until you are sure what you are getting. >> >> Regards, >> Willie >> >> FOR ThisRecord := 1 to oSHP:RecordCount >> oRecord := oSHP[ThisRecord] >> FOR ThisData := 1 to (oRecord:ShapeFields):Count >> oFld := oRecord:ShareFields[ThisData]:value >> NEXT >> NEXT >> >> > > > |
|
|||
|
Andrej,
I thought ShapeFields was an access with a parameter. But it seems that the problem is with the VO generated access (is VT_DISPATCH a typo? shouldn't it be VTS_DISPATCH). A few things you can try: 1. Change VT_DISPATCH to VTS_DISPATH, or VTS_PDISPATCH, or VTS_VARIANT, or VTS_PVARIANT 2. Don't use VO generated classes: declare ShapeFiles as OleControl or OleAutoObject, whatever is the case. If it's a problem with the generated class this should solve it. 3. Use a VB wrapper (VB6 is the easiest way) On 11-10-2011 18:29, andrej Terkaj wrote: > Thank you, Carlos ! > > Doesn't work. > Error msg: An unhandled exception occured in module MSVBM60.DLL in your > application Entity ShapeFiles:ShapeFields:Access line 12 > > ACCESS ShapeFields( ) CLASS ShapeFiles > LOCAL oMethod AS cOleMethod > > LOCAL uRetValue AS USUAL > > oMethod := cOleMethod{} > > oMethod:symName := String2Symbol("ShapeFields") > > oMethod:iMemberid := 1745027091 > > oMethod:wInvokeKind := INVOKE_PROPERTYGET > > oMethod:bRetType := VT_DISPATCH > > // line bellow is line No.12 > > uRetValue := SELF:__Invoke(oMethod, DWORD(_BP+16),PCount()) > > uRetValue := ShapeFields{uRetValue} > > RETURN (uRetValue) > > Best regards > > Andrej Terkaj > > > > > > > "Carlos Rocha"<carlos.rochaDELETETHIS@doossier.com> wrote in message > news:4e943110$0$2678$a729d347@news.telepac.pt... >> Try >> >> oFld := oSHP:[ShapeFields,ThisData] >> >> >> -- >> Carlos Rocha >> >> >> --- >> avast! Antivirus: Outbound message clean. >> Virus Database (VPS): 111010-2, 10-10-2011 >> Tested on: 11-10-2011 13:04:00 >> avast! - copyright (c) 1988-2011 AVAST Software. >> http://www.avast.com >> >> >> >> > > > -- Carlos Rocha --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 111010-2, 10-10-2011 Tested on: 11-10-2011 19:35:03 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com |
|
|||
|
I was wrong, sorry: VT_DISPATH is a possible value
--- avast! Antivirus: Outbound message clean. Virus Database (VPS): 111010-2, 10-10-2011 Tested on: 11-10-2011 19:37:22 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com |
|
|||
|
Dear Carlos !
a) oMethod:bRetType := VTS_DISPATCH // Conversion STR to BYTE not possible oMethod:bRetType := VT_DISPATH // unknown variable b) IF I change definitions METHOD Init(ObjID, fROTCHECK) CLASS ShapeFiles IF (ObjID=NIL) // ObjID := "ArcViewShapeFileOCX_crp.ShapeFiles" ObjID := "OleAutoobject" // ------------> then function ReadDataOnMove doesn't work ENDIF SUPER:Init(ObjID, 0, .T., fRotCheck) SELF:_dwFuncs := 69 SELF:_dwVars := 0 RETURN SELF c) VB wrapper ? I will try but I suspect that this is at least 5 days of work. If you are interested for SHP files, here is an address : Library: ArcViewShapeFileDLL (ArcView ShapeFile COM DLL vr 2.0.5 by CRP) Thanks again Andrej "Carlos Rocha" <carlos.rochaDELETETHIS@doossier.com> wrote in message news:4e948cb5$0$2683$a729d347@news.telepac.pt... > Andrej, > > I thought ShapeFields was an access with a parameter. > But it seems that the problem is with the VO generated access (is > VT_DISPATCH a typo? shouldn't it be VTS_DISPATCH). A few things you can > try: > > 1. Change VT_DISPATCH to VTS_DISPATH, or VTS_PDISPATCH, or VTS_VARIANT, or > VTS_PVARIANT > > 2. Don't use VO generated classes: declare ShapeFiles as OleControl or > OleAutoObject, whatever is the case. If it's a problem with the generated > class this should solve it. > > 3. Use a VB wrapper (VB6 is the easiest way) > > > On 11-10-2011 18:29, andrej Terkaj wrote: >> Thank you, Carlos ! >> >> Doesn't work. >> Error msg: An unhandled exception occured in module MSVBM60.DLL in your >> application Entity ShapeFiles:ShapeFields:Access line 12 >> >> ACCESS ShapeFields( ) CLASS ShapeFiles >> LOCAL oMethod AS cOleMethod >> >> LOCAL uRetValue AS USUAL >> >> oMethod := cOleMethod{} >> >> oMethod:symName := String2Symbol("ShapeFields") >> >> oMethod:iMemberid := 1745027091 >> >> oMethod:wInvokeKind := INVOKE_PROPERTYGET >> >> oMethod:bRetType := VT_DISPATCH >> >> // line bellow is line No.12 >> >> uRetValue := SELF:__Invoke(oMethod, DWORD(_BP+16),PCount()) >> >> uRetValue := ShapeFields{uRetValue} >> >> RETURN (uRetValue) >> >> Best regards >> >> Andrej Terkaj >> >> >> >> >> >> >> "Carlos Rocha"<carlos.rochaDELETETHIS@doossier.com> wrote in message >> news:4e943110$0$2678$a729d347@news.telepac.pt... >>> Try >>> >>> oFld := oSHP:[ShapeFields,ThisData] >>> >>> >>> -- >>> Carlos Rocha >>> >>> >>> --- >>> avast! Antivirus: Outbound message clean. >>> Virus Database (VPS): 111010-2, 10-10-2011 >>> Tested on: 11-10-2011 13:04:00 >>> avast! - copyright (c) 1988-2011 AVAST Software. >>> http://www.avast.com >>> >>> >>> >>> >> >> >> > > -- > Carlos Rocha > > > --- > avast! Antivirus: Outbound message clean. > Virus Database (VPS): 111010-2, 10-10-2011 > Tested on: 11-10-2011 19:35:03 > avast! - copyright (c) 1988-2011 AVAST Software. > http://www.avast.com > > > > |
|
|||
|
Dear andrej Terkaj:
On Oct 11, 11:30*am, "andrej Terkaj" <ater...@task.si> wrote: > Willie ! > I believe you, but ... My knowledge of VO stops when > we are talking about imported activeX code (look at > my answer to Carlos) OK, well there are a couple of things you need to know: #1, The .SHP file is an AutoCAD (open) standard, not ESRI. So if you are having difficulties in access, and you cannot find guidance at ESRI's website, then you might see what is published on the .SHP file standard looking for AutoCAD references. #2, ESRI has been moving away from the ArcView DBF+SHP file pair, to a single common Access-like structure with ArcGIS. So you may have to spend effort in working this also. It would be horrible if you were trying to access a SHP file that was no longer there... David A. Smith |
|
|||
|
Andrej,
If you have a link for the OCX and a sample file, I would be happy to look at it. I am guessing that I will have to use OLEAutoObject instead of the generated class. I work primarily in Vulcan.net now but I still support my VO libraries. Regards, Willie "andrej Terkaj" wrote in message news:j721vb$676$1@news.siol.net... Willie ! I believe you, but ... My knowledge of VO stops when we are talking about imported activeX code (look at my answer to Carlos) At this moment I am also still far away from Vulcan (.NET) environment. I plan to start with Vulcan to develop some extended appl. for hand held computers, but business always catched me in old VO projects. Best regards and thank you again for your answers. Andrej "Willie Moore" <williem@wmconsulting.com> wrote in message news:j720qp$t5k$1@speranza.aioe.org... > Andrej, > > Have you used the debugger to try to look into the OCX? If you really get > stuck you can always write some vb code to interface the OCX into your > code. Working with OCXs is much easier in Vulcan.net or VB.net. > > Regards, > Willie > > "andrej Terkaj" wrote in message news:j71vte$5ja$1@news.siol.net... > > Thank you Willie ! > > Doesn't work ! I made definitions as you proposed oSHP AS OBJECT > > oRecord := oSHP[ThisRecord] // VO Error operator used on non-array (I > agree) > > Best regards > > Andrej Terkaj > > > > > "Willie Moore" <williem@wmconsulting.com> wrote in message > news:j71cl4$5p9$1@speranza.aioe.org... >> Andrej, >> >> Have you tried something like the code below. You might have to type >> oRecord and oFld as object until you are sure what you are getting. >> >> Regards, >> Willie >> >> FOR ThisRecord := 1 to oSHP:RecordCount >> oRecord := oSHP[ThisRecord] >> FOR ThisData := 1 to (oRecord:ShapeFields):Count >> oFld := oRecord:ShareFields[ThisData]:value >> NEXT >> NEXT >> >> > > > |
|
|||
|
I tried it myself and it seems to work fine with the generated class.
The problem is that VB accepts ShapeIn.ShapeFields(ThisData).FieldName as a shortcut to ShapeIn.ShapeFields.Item(ThisData).FieldName but in VO we must use the later syntax, like ShapeIn:ShapeFields:[Item,ThisData]:FieldName -- Carlos Rocha --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 111010-2, 10-10-2011 Tested on: 12-10-2011 00:50:36 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com |
|
|||
|
David !
Thank you for your reply. Whenever I put a question on a forum I always spent some sleepless nights (hours) in solving of my problem. Of course I know also a technical details about structure of (standard) SHP file(s) and a that part of SHP file is DBF file. Do you think also that DBF file looking from a VO point is dead ? I use SQL DBMS maybe almost six years exclusively, but DBF is still here. b) Our (Slovenian) national institute for environment give us a distribution of official GIS data (about buildings, streets, counties etc..) only in this intermediate format. Best regards and thank you again Andrej "dlzc" <dlzc1@cox.net> wrote in message news:44531e87-9e33-4ad4-b5b3-8925cd1bd78b@y8g2000prb.googlegroups.com... Dear andrej Terkaj: On Oct 11, 11:30 am, "andrej Terkaj" <ater...@task.si> wrote: > Willie ! > I believe you, but ... My knowledge of VO stops when > we are talking about imported activeX code (look at > my answer to Carlos) OK, well there are a couple of things you need to know: #1, The .SHP file is an AutoCAD (open) standard, not ESRI. So if you are having difficulties in access, and you cannot find guidance at ESRI's website, then you might see what is published on the .SHP file standard looking for AutoCAD references. #2, ESRI has been moving away from the ArcView DBF+SHP file pair, to a single common Access-like structure with ArcGIS. So you may have to spend effort in working this also. It would be horrible if you were trying to access a SHP file that was no longer there... David A. Smith |
|
|||
|
Willie !
Here is the link: http://arcscripts.esri.com/details.asp?dbid=11810 I will be absent a few days, so I will not be able to reply. But it seems that Carlos Rocha solve a problem. Thank you and best regards. Andrej "Willie Moore" <williem@wmconsulting.com> wrote in message news:j72ff0$411$1@speranza.aioe.org... > Andrej, > > If you have a link for the OCX and a sample file, I would be happy to look > at it. I am guessing that I will have to use OLEAutoObject instead of the > generated class. I work primarily in Vulcan.net now but I still support my > VO libraries. > > Regards, > Willie > > "andrej Terkaj" wrote in message news:j721vb$676$1@news.siol.net... > > Willie ! > I believe you, but ... My knowledge of VO stops when we are talking about > imported activeX code (look at my answer to Carlos) > At this moment I am also still far away from Vulcan (.NET) environment. I > plan to start with Vulcan to develop some extended appl. for hand held > computers, but business always catched me in old VO projects. > Best regards and thank you again for your answers. > > Andrej > > > "Willie Moore" <williem@wmconsulting.com> wrote in message > news:j720qp$t5k$1@speranza.aioe.org... >> Andrej, >> >> Have you used the debugger to try to look into the OCX? If you really get >> stuck you can always write some vb code to interface the OCX into your >> code. Working with OCXs is much easier in Vulcan.net or VB.net. >> >> Regards, >> Willie >> >> "andrej Terkaj" wrote in message news:j71vte$5ja$1@news.siol.net... >> >> Thank you Willie ! >> >> Doesn't work ! I made definitions as you proposed oSHP AS OBJECT >> >> oRecord := oSHP[ThisRecord] // VO Error operator used on non-array (I >> agree) >> >> Best regards >> >> Andrej Terkaj >> >> >> >> >> "Willie Moore" <williem@wmconsulting.com> wrote in message >> news:j71cl4$5p9$1@speranza.aioe.org... >>> Andrej, >>> >>> Have you tried something like the code below. You might have to type >>> oRecord and oFld as object until you are sure what you are getting. >>> >>> Regards, >>> Willie >>> >>> FOR ThisRecord := 1 to oSHP:RecordCount >>> oRecord := oSHP[ThisRecord] >>> FOR ThisData := 1 to (oRecord:ShapeFields):Count >>> oFld := oRecord:ShareFields[ThisData]:value >>> NEXT >>> NEXT >>> >>> >> >> >> > > > |
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|