Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #2234 > unrolled thread

VisualBasic 2 VO - reading ESRI SHP files

Started by"andrej Terkaj" <aterkaj@task.si>
First post2011-10-11 12:32 +0200
Last post2011-10-12 13:11 +0200
Articles 20 — 5 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  VisualBasic 2 VO - reading ESRI SHP files "andrej Terkaj" <aterkaj@task.si> - 2011-10-11 12:32 +0200
    Re: VisualBasic 2 VO - reading ESRI SHP files Carlos Rocha <carlos.rochaDELETETHIS@doossier.com> - 2011-10-11 13:03 +0100
      Re: VisualBasic 2 VO - reading ESRI SHP files "andrej Terkaj" <aterkaj@task.si> - 2011-10-11 19:29 +0200
        Re: VisualBasic 2 VO - reading ESRI SHP files Carlos Rocha <carlos.rochaDELETETHIS@doossier.com> - 2011-10-11 19:35 +0100
          Re: VisualBasic 2 VO - reading ESRI SHP files "andrej Terkaj" <aterkaj@task.si> - 2011-10-11 21:44 +0200
            Re: VisualBasic 2 VO - reading ESRI SHP files Carlos Rocha <carlos.rochaDELETETHIS@doossier.com> - 2011-10-12 00:50 +0100
              Re: VisualBasic 2 VO - reading ESRI SHP files "andrej Terkaj" <aterkaj@task.si> - 2011-10-12 08:52 +0200
              Re: VisualBasic 2 VO - reading ESRI SHP files "andrej Terkaj" <aterkaj@task.si> - 2011-10-14 15:52 +0200
        Re: VisualBasic 2 VO - reading ESRI SHP files Carlos Rocha <carlos.rochaDELETETHIS@doossier.com> - 2011-10-11 19:37 +0100
    Re: VisualBasic 2 VO - reading ESRI SHP files "Willie Moore" <williem@wmconsulting.com> - 2011-10-11 07:26 -0500
      Re: VisualBasic 2 VO - reading ESRI SHP files "andrej Terkaj" <aterkaj@task.si> - 2011-10-11 19:54 +0200
        Re: VisualBasic 2 VO - reading ESRI SHP files "Willie Moore" <williem@wmconsulting.com> - 2011-10-11 13:10 -0500
          Re: VisualBasic 2 VO - reading ESRI SHP files "andrej Terkaj" <aterkaj@task.si> - 2011-10-11 20:30 +0200
            Re: VisualBasic 2 VO - reading ESRI SHP files dlzc <dlzc1@cox.net> - 2011-10-11 14:53 -0700
              Re: VisualBasic 2 VO - reading ESRI SHP files "andrej Terkaj" <aterkaj@task.si> - 2011-10-12 08:42 +0200
                Re: VisualBasic 2 VO - reading ESRI SHP files dlzc <dlzc1@cox.net> - 2011-10-12 06:46 -0700
            Re: VisualBasic 2 VO - reading ESRI SHP files "Willie Moore" <williem@wmconsulting.com> - 2011-10-11 17:20 -0500
              Re: VisualBasic 2 VO - reading ESRI SHP files "andrej Terkaj" <aterkaj@task.si> - 2011-10-12 08:48 +0200
    Re: VisualBasic 2 VO - reading ESRI SHP files Johan Nel <johan.nel@xsinet.co.za> - 2011-10-11 23:55 -0700
      Re: VisualBasic 2 VO - reading ESRI SHP files "andrej Terkaj" <aterkaj@task.si> - 2011-10-12 13:11 +0200

#2234 — VisualBasic 2 VO - reading ESRI SHP files

From"andrej Terkaj" <aterkaj@task.si>
Date2011-10-11 12:32 +0200
SubjectVisualBasic 2 VO - reading ESRI SHP files
Message-ID<j715vr$r6i$1@news.siol.net>
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





[toc] | [next] | [standalone]


#2235

FromCarlos Rocha <carlos.rochaDELETETHIS@doossier.com>
Date2011-10-11 13:03 +0100
Message-ID<4e943110$0$2678$a729d347@news.telepac.pt>
In reply to#2234
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


[toc] | [prev] | [next] | [standalone]


#2246

From"andrej Terkaj" <aterkaj@task.si>
Date2011-10-11 19:29 +0200
Message-ID<j71ud0$51v$1@news.siol.net>
In reply to#2235
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
>
>
>
> 


[toc] | [prev] | [next] | [standalone]


#2251

FromCarlos Rocha <carlos.rochaDELETETHIS@doossier.com>
Date2011-10-11 19:35 +0100
Message-ID<4e948cb5$0$2683$a729d347@news.telepac.pt>
In reply to#2246
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


[toc] | [prev] | [next] | [standalone]


#2253

From"andrej Terkaj" <aterkaj@task.si>
Date2011-10-11 21:44 +0200
Message-ID<j726a4$7sk$1@news.siol.net>
In reply to#2251
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
>
>
>
> 


[toc] | [prev] | [next] | [standalone]


#2257

FromCarlos Rocha <carlos.rochaDELETETHIS@doossier.com>
Date2011-10-12 00:50 +0100
Message-ID<4e94d6ad$0$2683$a729d347@news.telepac.pt>
In reply to#2253
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


[toc] | [prev] | [next] | [standalone]


#2260

From"andrej Terkaj" <aterkaj@task.si>
Date2011-10-12 08:52 +0200
Message-ID<j73dec$cr8$1@news.siol.net>
In reply to#2257
Carlos !

Thank you again. I will be absent a few days. After my return I will once 
again import a OCX control in my VO (VO 2.8 SP2)

Best regards
Andrej

"Carlos Rocha" <carlos.rochaDELETETHIS@doossier.com> wrote in message 
news:4e94d6ad$0$2683$a729d347@news.telepac.pt...
>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
>
>
>
> 


[toc] | [prev] | [next] | [standalone]


#2283

From"andrej Terkaj" <aterkaj@task.si>
Date2011-10-14 15:52 +0200
Message-ID<j79er6$gur$1@news.siol.net>
In reply to#2257
Dear Carlos !

Yes, you are right, now it works. I am very gratefull (youth would say 
'respect')

Andrej Terkaj

"Carlos Rocha" <carlos.rochaDELETETHIS@doossier.com> wrote in message 
news:4e94d6ad$0$2683$a729d347@news.telepac.pt...
>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
>
>
>
> 


[toc] | [prev] | [next] | [standalone]


#2252

FromCarlos Rocha <carlos.rochaDELETETHIS@doossier.com>
Date2011-10-11 19:37 +0100
Message-ID<4e948d40$0$2683$a729d347@news.telepac.pt>
In reply to#2246
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


[toc] | [prev] | [next] | [standalone]


#2236

From"Willie Moore" <williem@wmconsulting.com>
Date2011-10-11 07:26 -0500
Message-ID<j71cl4$5p9$1@speranza.aioe.org>
In reply to#2234
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

[toc] | [prev] | [next] | [standalone]


#2247

From"andrej Terkaj" <aterkaj@task.si>
Date2011-10-11 19:54 +0200
Message-ID<j71vte$5ja$1@news.siol.net>
In reply to#2236
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
>
> 


[toc] | [prev] | [next] | [standalone]


#2248

From"Willie Moore" <williem@wmconsulting.com>
Date2011-10-11 13:10 -0500
Message-ID<j720qp$t5k$1@speranza.aioe.org>
In reply to#2247
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
>
>

[toc] | [prev] | [next] | [standalone]


#2249

From"andrej Terkaj" <aterkaj@task.si>
Date2011-10-11 20:30 +0200
Message-ID<j721vb$676$1@news.siol.net>
In reply to#2248
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
>>
>>
>
>
> 


[toc] | [prev] | [next] | [standalone]


#2254

Fromdlzc <dlzc1@cox.net>
Date2011-10-11 14:53 -0700
Message-ID<44531e87-9e33-4ad4-b5b3-8925cd1bd78b@y8g2000prb.googlegroups.com>
In reply to#2249
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

[toc] | [prev] | [next] | [standalone]


#2258

From"andrej Terkaj" <aterkaj@task.si>
Date2011-10-12 08:42 +0200
Message-ID<j73cse$cag$1@news.siol.net>
In reply to#2254
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


[toc] | [prev] | [next] | [standalone]


#2264

Fromdlzc <dlzc1@cox.net>
Date2011-10-12 06:46 -0700
Message-ID<283bf8a5-ead3-48b7-aac3-c8e21afbb701@k25g2000prf.googlegroups.com>
In reply to#2258
Dear andrej Terkaj:

On Oct 11, 11:42 pm, "andrej Terkaj" <ater...@task.si> wrote:
>
> 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 ?

It is not exactly dead if the information you need is in one.  But the
data you will be presented with will (more and more) be packaged
however ESRI can do it to stay employed.

> 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.

Similar instance for me, where sewer networks were in the DBF/SHP
format, the program that analyzed the sewer network accepted /
produced only DBF (but incompatible format), and the pretty pictures
for the customer were back in ESRI's product.  So we started updating
to ArcGIS, to find out we'd lost our pathway from the data store to
the analysis program.

Sooner or later your customer will update their software too...

Sorry to distract from your need to get the OCX working.  Are you
certain there is an DBF/SHP file in this instance?  If so, have you
compared the first few bytes of the SHP file to an older file (Wordpad
will actually do a reasonable job), to see if there has been a change
in format?

David A. Smith

[toc] | [prev] | [next] | [standalone]


#2255

From"Willie Moore" <williem@wmconsulting.com>
Date2011-10-11 17:20 -0500
Message-ID<j72ff0$411$1@speranza.aioe.org>
In reply to#2249
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
>>
>>
>
>
>

[toc] | [prev] | [next] | [standalone]


#2259

From"andrej Terkaj" <aterkaj@task.si>
Date2011-10-12 08:48 +0200
Message-ID<j73d72$chk$1@news.siol.net>
In reply to#2255
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
>>>
>>>
>>
>>
>>
>
>
> 


[toc] | [prev] | [next] | [standalone]


#2261

FromJohan Nel <johan.nel@xsinet.co.za>
Date2011-10-11 23:55 -0700
Message-ID<f97575ab-a3a9-4153-8d37-22d185b3a86b@q13g2000vby.googlegroups.com>
In reply to#2234
Andrej,

Here is the link for the shapefile format.

You can read it with pure FOpen(), FRead()

www(dot)esri(dot)com(forwardslash)library(forwardslash)whitepapers(forwardslash)pdfs(forwardslash)shapefile.pdf

Obviously you will need to convert from HEX to Decimal for each of the
values.

HTH,

Johan Nel
Pretoria, South Africa.

On Oct 11, 12:32 pm, "andrej Terkaj" <ater...@task.si> wrote:
> 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

[toc] | [prev] | [next] | [standalone]


#2262

From"andrej Terkaj" <aterkaj@task.si>
Date2011-10-12 13:11 +0200
Message-ID<j73sk2$ppc$1@news.siol.net>
In reply to#2261
Dear Johan !
Thank you for your reply. I know the techical specifications and structure 
for the SHP file. But I adressed my problem with this format to the 
community  using OCX control that
exists hoping that such control (which was probably written by the author 
who spents plenty of hours studying SHP structure) is working properly and 
that I can avoid low level reading.

Best regards

Andrej

"Johan Nel" <johan.nel@xsinet.co.za> wrote in message 
news:f97575ab-a3a9-4153-8d37-22d185b3a86b@q13g2000vby.googlegroups.com...
Andrej,

Here is the link for the shapefile format.

You can read it with pure FOpen(), FRead()

www(dot)esri(dot)com(forwardslash)library(forwardslash)whitepapers(forwardslash)pdfs(forwardslash)shapefile.pdf

Obviously you will need to convert from HEX to Decimal for each of the
values.

HTH,

Johan Nel
Pretoria, South Africa.

On Oct 11, 12:32 pm, "andrej Terkaj" <ater...@task.si> wrote:
> 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



[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web